Some more cleanup and refactorings

* Reformatted long line.
* Refactored ClientHandler to make code more organized
    * Also, easier to write tests for.

[Update] Fixed implicit conversions warning
[Update] Fixed passing `log` around
Merge pull request #236 from typesafehub/wip/elucidator-integration-more-cleanup

Some more cleanup and refactorings