added some more comments and generated javadocs