This file needs to be rewritten. I think, otherwise, the point of this refactor is completely lost to me. Looks like a lot of complexity got pushed to this one. Let's make this more readable?