added comments and javadocs