Added some docstrings, more robust test case.