minor changes to code, including to startdate and enddate