moved the delete attributes code