Verious changes to error reporting and handeling and delete function's