Added further tests and started writing extensive javadoc.