Determining $\int \frac{(x-1)\sqrt{x^4+2x^3-x^2+2x+1}}{x^2(x+1)}dx$ 
$$\int \frac{(x-1)\sqrt{x^4+2x^3-x^2+2x+1}}{x^2(x+1)}dx$$

Attempt:
Simplification of the root factor:
$$\sqrt{x^4+2x^3-x^2+2x+1}=\frac{1}{x}\sqrt{\left(x^2+\frac{1}{x^2}\right)+2\left(x+\frac{1}{x}\right)-1}.$$
Arranging the rest of the factors as:
$$\frac{x-1}{x^2(x+1)}=\frac{x^2-1}{x^2(x+1)^2}$$
Now I did the following substitution: let $(x+\frac{1}{x})=t$, so $(1-\frac{1}{x^2})dx=dt$
Arranging the integral: $$I=\int \frac{\sqrt{t^2+2t-3}}{t+2}dt.$$
But what to do next?
I tried integration by parts for this but couldn't simplify my result.

Maybe it's not the most rapid way, but it seems work. We have, taking $u=t+1
 $ $$\int\frac{\sqrt{t^{2}+2t-3}}{t+2}dt=\int\frac{\sqrt{u^{2}-4}}{u+1}du
 $$ and taking $u=2\sec\left(v\right)
 $ we have $$=4\int\frac{\tan^{2}\left(v\right)\sec\left(v\right)}{2\sec\left(v\right)+1}dv=4\int\frac{\tan^{2}\left(v\right)}{\cos\left(v\right)+2}dv
 $$ using $\tan^{2}\left(v\right)=\sec^{2}\left(v\right)+1
 $. Now we can take $w=\tan\left(v/2\right)
 $ and get $$=32\int\frac{w^{2}}{w^{6}+w^{4}-5w^{2}+3}dw=32\int\frac{w^{2}}{\left(w^{2}-1\right)^{2}\left(w^{2}+3\right)}dw
 $$ and now using a boring partial fractions you can transform the integral in a tractable form.
