More cleanup and added Javadocs.