Added a test case
Added a test case
Added Javadoc comments and some tidy up