use for range instead for index