Properly separated business logic and refactored the tests to do some unit testing and behaviour testing