removed some println's and added javadoc