Refactor and javadoc finish