added helper functions for range