added some javadocs and comments