Changed getDataRange to getTimeRange using new min and max function