Added javadocs and comments