Added further documentation and test case coverage.