Major refactoring so we can compile against yesod 1.2.