added better date handling