javadoc added and code updated