added some comments and syntax changes