works for range