Cleaned up and added javadocs