added code comments & javadoc