Added some comments and javadoc.