added javadoc, some cleanup