adding tests and javadoc