add tests
cleanup code