minor refactoring
minor refactoring
add javadoc