cleaned up date logic