Change edit and delete functions to handle error logging