Was wrong again. Updated code and comments. Confirmed to be correct this time around.