Improve date handling