Risk-neutral expectation equation with collateral and funding costs

I am looking at a paper by V. Piterbarg, Funding beyond discounting: collateral agreements and derivatives pricing, that you can download on the following link, in which the author adapts the Black-Scholes pricing framework to introduce collateral and funding at a non-risk-free rate.

Letting $V_t \equiv V(t)$ and $C_t \equiv C(t)$, I am having trouble to go from equation $(3)$...

$$V_t = E_t \left[ e^{-\int_t^Tr_F(u)du}V_T+\int_t^Te^{-\int_t^ur_F(v)dv}\left( r_F(u)-r_C(u)\right) C_u \ du \right]$$

... to equation $(5)$:

$$V_t = E_t \left[ e^{-\int_t^Tr_C(u)du}V_T\right]-E_t \left[\int_t^Te^{-\int_t^ur_C(v)dv}\left( r_F(u)-r_C(u)\right) \left(V_u-C_u\right)du \right]$$

According to the author, to go from $(3)$ to $(5)$ we only need to "rearrange terms".

Can anybody show how to go from one to the other?

One derivation is to replace $V_u$ in Equation $(5)$ using the expression given by Equation $(3)$ and then work out to reach $(5)$; see Appendix A in this paper for more details. Here, we provide another derivation. See also this question.

We recall that, from $(2)$ of Piterbarg, \begin{align*} V_t = \Delta (t) S(t) + \gamma(t), \end{align*} where $\Delta (t)= \frac{\partial V(t)}{\partial S}$, and $\gamma(t)$ is the cash account that satisfies \begin{align*} d\gamma(t) &= \big[r_C(t) C(t) + r_F(t)(V(t)-C(t))-(r_R(t)-r_D(t))\Delta(t)S(t) \big]dt\\ &=\big[r_F(t)V(t) + (r_C(t)-r_F(t)) C(t)-(r_R(t)-r_D(t))\Delta(t)S(t) \big]dt. \end{align*} Moreover, based on Equation $(4)$ in the paper, \begin{align*} dS(t)/S(t) = (r_R(t)-r_D(t))dt + \sigma_S(t) dW_S(t). \end{align*} Then, from the self-financing condition, \begin{align*} dV_t &= \Delta (t) dS(t) + d\gamma(t)\\ &=\big[r_F(t)V_t + (r_C(t)-r_F(t)) C(t)\big]dt + \Delta (t)S(t)\sigma_S(t) dW_S(t). \tag{*} \end{align*}

From $(*)$, \begin{align*} d\left(e^{-\int_0^t r_F(v)dv}V_t \right) &=-r_F(t)e^{-\int_0^t r_F(v)dv}V_tdt + e^{-\int_0^t r_F(v)dv}dV_t\\ &=e^{-\int_0^t r_F(v)dv}\big[(r_C(t)-r_F(t)) C(t)dt + \Delta (t)S(t)\sigma_S(t) dW_S(t)\big]. \end{align*} Therefore, \begin{align*} e^{-\int_0^T r_F(v)dv}V_T-e^{-\int_0^t r_F(v)dv}V_t &=\int_t^Te^{-\int_0^u r_F(v)dv}\big[(r_C(u)-r_F(u)) C(u)du\\ &\qquad + \int_t^T\Delta (u)S(u)\sigma_S(u) dW_S(u). \end{align*} Taking conditional expectation with respect to $\mathscr{F}_t$ on both sides, we obtain that \begin{align*} E_t\left(e^{-\int_0^T r_F(v)dv}V_T \right)-e^{-\int_0^t r_F(v)dv}V_t &=E_t\left(\int_t^Te^{-\int_0^u r_F(v)dv}\big[(r_C(u)-r_F(u)) C(u)du\right), \end{align*} which leads to Equation $(3)$ in Piterbarg, that is, \begin{align*} V_t &= E_t\left(e^{-\int_t^T r_F(v)dv}V_T + \int_t^Te^{-\int_t^u r_F(v)dv}\big[(r_F(u)-r_C(u)) C(u)du\right)\tag{3} \end{align*}

 To derive Equation $(5)$, we note that, from $(*)$ above, by rearranging terms, \begin{align*} dV_t &= \big[r_F(t)V_t + (r_C(t)-r_F(t)) C(t)\big]dt + \Delta (t)S(t)\sigma_S(t) dW_S(t)\\ &=\big[r_C(t)V_t + (r_F(t)-r_C(t))(V_t -C(t))\big]dt + \Delta (t)S(t)\sigma_S(t) dW_S(t).\tag{**} \end{align*} As above, \begin{align*} d\left(e^{-\int_0^t r_C(v)dv}V_t \right) &=-r_C(t)e^{-\int_0^t r_C(v)dv}V_tdt + e^{-\int_0^t r_C(v)dv}dV_t\\ &=e^{-\int_0^t r_C(v)dv}\big[(r_F(t)-r_C(t))(V_t -C(t))dt + \Delta (t)S(t)\sigma_S(t) dW_S(t) \big], \end{align*} and, consequently, \begin{align*} E_t\left(e^{-\int_0^T r_C(v)dv}V_T \right) -e^{-\int_0^t r_C(v)dv}V_t&=E_t\left( \int_t^Te^{-\int_0^u r_C(v)dv}\big[(r_F(u)-r_C(u))(V_u -C(u))du\right), \end{align*} which leads to Equation $(5)$ in Piterbarg immediately, that is, \begin{align*} V_t =E_t\left(e^{-\int_t^T r_C(v)dv}V_T \right) - E_t\left(\int_t^Te^{-\int_t^u r_C(v)dv}\big[(r_F(u)-r_C(u))(V_u -C(u))du \right). \tag{5} \end{align*}