implemented the remove method