Added tests, some documentation.