I assume the conditional is to prevent the `delete_if` operation if the hash is empty, for performance reasons?