Major cleanup. Added Javadoc comments, deleted commented out code, etc.