added javadoc
refactor