updated javadoc, clean up of code