Added comments, javadocs, and debugging lines