added error handling for add and delete commands