Added further tests and documentation.