Added tests and documentation