added tests and test functionality