Wrote javadoc and multiple bug fixes