refactor ranges