Added some comments and other minor changes.