Feature/cleanup

Huge refactor and test writing. All should be prepared for the implementation.