Forgot a file
Mostly finished refactoring (still needs language/import cleanups before merge, plus review)