Added tests and updated docs