Update javadoc
Refactor for readability