added javadocs among other things