Finish javadoc comments and refactor