Cleaned up comments, added javadoc