Resolve TODOs and formatting of Handler module

Resolve the TODO comments regarding logging output in the Handler
module and, at the same time, the code formatting, comments and
organisation.