Improved date handling