Exact Differential Equation

I am told to verify that the given differential equation is exact; then solve it:

(x + tan-1y)dx + ((x + y)/(1 + y^2))dy=0

So far I have found the exactness and have gotten down to

F= (x^2) + 2xtan^(-1) (y) + g(y)

I am then trying to find g(y) and to do this do I have to set

F= (x^2) + 2xtan^(-1) (y) + g(y) = ((x + y)/(1 + y^2))

If I do, how in the world do I cancel things out to get the anwer!

The answer is suppose to be

(x^2) + 2xtan^(-1) (y) + ln(1+y^2)

Please help

Thanks