More refactoring. Urgh.