added tests and implementation