adding tests and javadocs