Minor refactoring around ranges.contract()