integrating CDF functions by parts This is a derivation from "Exercises in Recursive Macroeconomic Theory
preliminary and incomplete by 
Stijn Van Nieuwerburgh
Pierre-Olivier Weill
Lars Ljungqvist
Thomas J. Sargent"

which uses integration by parts. Can someone explain how this derivation works? I have tried to replicate the result but to no avail. The text says that they use integration by parts on the second integral on the second line [the integral from w to B of w'dF(w') ]
The integral of interest is $\int_{w^*}^Bw'dF(w')$, which we get after bringing $\frac{1}{1-\beta}$ out from the last integral on the second line. I assume that $F(B)=1$. First, we have:

$$
\int_{w^*}^Bw'dF(w')=w'F(w')\vert_{w^*}^B - \int^B_{w^*}
F(w')dw'
$$
from integration by parts with $u=w'$ and $dv=dF(w')$. We can evaluate the first term on the right-hand side and both add and subtract $B-w^*=\int^B_{w^*}dw'$ to get:

$$
\int_{w^*}^Bw'dF(w')= [B - w^*F(w^*)]-[B-w^*]+\int^B_{w^*}(1-F(w')dw'.
$$

Note that I used my initial assumption here, and that I brought $B-w^*=\int^B_{w^*}dw'$ under the pre-existing integral.It should be clear after a bit of algebra that:

$$
\int_{w^*}^Bw'dF(w')= w^*(1 - F(w^*))+\int^B_{w^*}(1-F(w')dw'.
$$

The rest should be easy after multipling both sides by the $\frac{\beta}{1-\beta}$ factor.