Refactored and added tests.