added javadoc comment
refactoring to reduce method complexity