Added tests and comments