testing and refactoring