Adding code to save data, reload data when the date is changed