Refactoring delete button implementation.