refactoring
add tests
faster now()