add tests
add comments and tests