Refactored remove method