added test and refactoring