and one more note to improve readability replace
```
unless oldhn.empty?
```
with
```
return if oldhn.empty?

```

so it is easier to see, that you do method only if there is something to remove.