Refactored/added tests