also modified the remove method.