Add delete function
Add error handling