Added some comments and formatting.