refactored how dates are handled