Added some tests
Refactoring