Minor refactoring of range