I beautified the code, added some comments, changed some variables