Having trouble integrating $ \ \ \int \frac{x^{3}+3x^{2}+2x+4}{x^{2}(x^{2}+2x+2)} dx $. I'm having trouble integrating $$\int \frac{x^{3}+3x^{2}+2x+4}{x^{2}(x^{2}+2x+2)} dx $$
My approach


*

*$ \frac{x^{3}+3x^{2}+2x+4}{x^{2}(x^{2}+2x+2)} =\frac{Ax+B}{x^{2}}+\frac{Cx+D}{x^{2}+2x+2} $ , 

*or, $ x^{3}+3x^{2}+2x+4=(Ax+B)(x^{2}+2x+2)+(Cx+D)x^{2} $ . 


But is the process right ? If not, Any suggestions are welcome.
 A: $$\int \frac{x^3+3x^2+2x+4}{x^2(x^2+2x+2)}dx=\int \frac{x^3+3x^2+2(x+2)}{x^2(x^2+2x+2)}dx=\int (\frac{2x+3}{x^2+2x+2}-\frac{1}{x}+\frac{2}{x^2})dx=\int \frac{2x+3}{x^2+2x+2}dx-\int\frac{1}{x}dx+2\int\frac{1}{x^2}dx$$
Now solving: $\int \frac{2x+3}{x^2+2x+2}dx$ , write $2x+3$ as $2x+2+1$ and split it, we have:
$$\int \frac{2x+3}{x^2+2x+2}dx=\int (\frac{2x+2}{x^2+2x+2}+\frac{1}{x^2+2x+2})dx=2\int\frac{x+1}{x^2+2x+2}dx+\int\frac{1}{x^2+2x+2}dx$$
Now solving $\int\frac{x+1}{x^2+2x+2}dx$ ; substitute $u=x^2+2x+2\Rightarrow \frac{du}{dx}=2x+2$, so : 
$$\int\frac{x+1}{x^2+2x+2}dx=\frac{1}{2}\int\frac{1}{u}du=\frac{ln(u)}{2}$$
Undo substitution $u=x^2+2x+2$ :
$$\int\frac{x+1}{x^2+2x+2}dx=\frac{ln(x^2+2x+2)}{2}$$
Now solving $\int\frac{1}{x^2+2x+2}dx=\int\frac{1}{(x+1)^2+1}dx$
Substitute $u=x+1\Rightarrow \frac{du}{dx}=1$
$$\int\frac{1}{(x+1)^2+1}dx=\int\frac{1}{u^2+1}du=arctan(u)=arctan(x+1)$$
Now we have:
$$\int\frac{1}{x}dx=ln(x)$$
$$\int\frac{1}{x^2}dx=-\frac{1}{x}$$
Plug in solved integrals we have:
$$\int \frac{x^3+3x^2+2x+4}{x^2(x^2+2x+2)}dx=ln(|x^2+2x+2|)-ln(|x|)+arctan(x+1)-\frac{2}{x}+C$$
Apply the absolute value function to arguments of logarithm functions in order to extend the antiderivatieve's domain! 
Wish I haven't make a typing mistake ...
A: HINT: we have $$\frac{x^3+3x^2+2x+4}{x^2(x^2+2x+2)}=-\frac{1}{x}+\frac{2}{x^2}+\frac{2x+3}{x^2+2x+2}$$
