Added tests and validation