Added delete functionality and error messages