some changes; added javadoc