Clean out dead code, add tests to new code and add log entries. Closes #89