Added some comments so that future editors of this code will not have to go as insane as I did