Added some comments and variable name changes