minor refactoring + JavaDoc