Added some more unit tests and javadocs