added javadoc and some minor changes