add test suite, refactor code