added tests and validation