credits for get_dates, some cleaning