Pivot refactoring