Merge review of 9.47.1

Much of the code in this file is duplicated from `clearinghoused.py`, need to verify our customisations were correctly copied over.