Payday rewrite, part 5

WIP. Step 6 of #2508. Follow-on from #2541.