I'm pretty sure that code was just something I Copy/Pasta'd from the original until I reached that particular section of code for refactoring.

Essentially what I did there was move a couple of global functions into the class that should be responsible for the logic.