Refactoring tests and classes