Payday rewrite, part 4

Step 5 of #2508. Follow-on from #2540.