Adds tests
Refactors & implements new functionality