Refactoring & bugfixes
Fixed bugs
Refactoring
Added unit tests