Reorganizing refactoring

Adding some tests ~