Refactor for date support