Added javadoc and a few comments