Payday rewrite, part 5

Step 6 of #2508. Follow-on from #2541.
What's the purpose of the subselect instead of just using $1? Is this some sort of validation of the input?