Added test routine, added javadocs