Payday rewrite, part 2

Step 3 of #2508. Follow-on from #2538.