I refactored the variables to be self explanatory. I think this is cleaner than adding comments. Hope this is okay for you.