fix exiting and take a date as a parameter