Refactored, fixed logger, add tests.
Merge branch 'feature/5' into develop