Moving validate_intervals to util for #49