range refactor