refactoring in a few files