Added further documentation and test cases.