Finding an expression for $M$ in terms of $t$. differential equations 

The mass $M$ at time $t$ of the leaves of a certain plant varies according to the differential equation $$\frac{\mathrm{d}m}{\mathrm{d}t}= M-M^2$$
Given that at time $t=0$, $M=0.5$, find an expression for $M$ in terms of $t$


I wasn't sure how to start so I began by solving the differential equation to get $$\frac{1}{M-M^2}\mathrm{d}M=\mathrm{d}t$$
Then simplifying, I get $$ln\frac{M}{1-M}=t$$ using log rules. To cancel $ln$ I get $$\frac{M}{1-M}=e^t$$ and then I get $M=e^t-me^t$
However the answer is $$\frac{e^t}{1+e^t}$$
I don't understand how they got that?

$$\frac{dM}{M-M^2}=\mathrm{d}t$$
$$\int \frac{dM}{M(1-M)}=t+c$$
$$\int \frac{dM}{M}+\int \dfrac {dM}{1-M}=t+c$$
$$\int \frac{dM}{M}-\int \dfrac {dM}{M-1}=t+c$$
$$\ln |M|-\ln {|M-1|}=t+c$$
$$\dfrac M{M-1}=Ce^t$$
$$M={(M-1)}Ce^t$$
$$M(1-Ce^t)=-Ce^t$$
This gives us:
$$M(t)=\dfrac {-Ce^t}{1-Ce^t}$$
Then apply initial condition:
$$M(0)=\dfrac 12 \implies C=-1$$
$$M(t)=\dfrac {e^t}{1+e^t}$$
