Refactor and JavaDoc'ing