refactor module
add tests