added tests
clean code