added tests and functionality