done refactoring and javadoc