Refactoring & Tests

WIP