tests and implementation for `remove/2`