added some comments and recreated the javadocs