Evaluate the integral $\int \frac{x^2(x-2)}{(x-1)^2}dx$ 
Find $$\int \frac{x^2(x-2)}{(x-1)^2} dx .$$

My attempt:
$$\int \frac{x^2(x-2)}{(x-1)^2}dx = \int \frac{x^3-2x^2}{x^2-2x+1}dx $$
By applying polynomial division, it follows that
$$\frac{x^3-2x^2}{x^2-2x+1} = x + \frac{-x}{x^2-2x+1}$$
Hence $$\int \frac{x^3-2x^2}{x^2-2x+1}dx  = \int \left(x + \frac{-x}{x^2-2x+1}\right) dx =\int x \,dx + \int \frac{-x}{x^2-2x+1} dx \\ = \frac{x^2}{2} + C + \int \frac{-x}{x^2-2x+1} dx $$  Now using substitution $u:= x^2-2x+1$ and $du = (2x-2)\,dx $ we get $dx= \frac{du}{2x+2}$.
Substituting dx in the integral:
$$\frac{x^2}{2} + C + \int \frac{-x}{u} \frac{1}{2x-2} du =\frac{x^2}{2} + C + \int \frac{-x}{u(2x-2)}  du $$
I am stuck here. I do not see how using substitution has, or could have helped solve the problem. I am aware that there are other techniques for solving an integral, but I have been only taught substitution and would like to solve the problem accordingly.
Thanks

$\int \frac{x^2(x-2)}{(x-1)^2} dx$
$\int {x^2(x-1-1)\over(x-1)^2}dx$
$\int {x^2(x-1)-x^2\over(x-1)^2}dx$
$\int ({x^2\over(x-1)}-{x^2\over(x-1)^2})dx$
$\int {x^2\over(x-1)}dx-\int{x^2\over(x-1)^2}dx$
$t=x-1 => dt=dx$
$\int {(t+1)^2\over(t)}dt-\int{(t+1)^2\over(t)^2}dt$
$\int {(t^2+1+2t)\over(t)}dt-\int(1+{1\over t})^2dt$
$\int (t+{1\over t}+2)dt-\int(1+{1\over t})^2dt$
$\int t dt+\int{1\over t}dt+\int2dt-\int(1+{1\over t})^2dt$
${t^2\over2}+\ln t+2t-t+{1\over t}-2\ln t+C$
${(x-1)^2\over2}+(x-1)+{1\over x-1}-\ln |x-1|+C$
