Added JavaDocs and comments