added date logic