Refactored remove operation