Added some comments, minor syntactic changes