range iterator refactor