Gap refactoring