Modified the remove method to make it more readable