common refactoring