refactoring and javadoc