Some renaming and minor refactoring.