added javadoc
added comments
fix merge conflicts