updated save and delete functions