More refactoring. Still broken.