Added better error handling for delete
Added better error handling for delete