improved retreat date logic