Added some comments and minor edits