DDF-249 added javadoc and cleaned up some code