Clean up compat code

I'm half way done, just wanted to put it up for public review. I'll add line comments on why it works without the compat code in the morning..