First steps in fixing all the stuff I broke in refactoring