Added tests and unit tests