Housekeeping in preparation for [20424]

Just did some general tidy-up work on the code.