1. David had gone home before we arrived.
→ After David had gone home, we arrived.
2. We had lunch then we took a look around the shops.
→ Before we took a look around the shop, we had had lunch.
3. The light had gone out before we go out of the office.
→ When we got out of the office, the light had gone out.
4. After she had explained everything clearly, we stared out work.
→ By the time we started our work, she had explained everything clearly.