perform refactoring;
add unit test