renaming and minor refactorings