More refactoring, some renaming.