Major refactoring for 2.2

DONT MERGE YET

Going to do some manual testing, wanted to get this up for review in parallel.