gave credit for the compareTimes function