Refactor in progress.

Refactoring log collection, login, http handling...