Refactoring complete

Things need to be tested