Common refactoring.