added date params and error handling