Resolve TODOs and formatting of Handler module

**WIP - do not merge**

Resolve the TODO comments regarding logging output in the Handler
module and, at the same time, the code formatting, comments and
organisation.