Added comments and Javadocs to code.