added comments
Added comments and javadocs.