Use single implementation of `remove-edges'` to reduce duplication