Removal of unused and untested functionality and overall cleanup.
Infrastructure for convenient logging during tests.
Marked TODOs for missing test coverage.