added tests
code cleanup