some cleanup
added tests
cleanup