added a few tests and javadoc