code refactoring
add test