Clean up and began to write javadoc