could we perhaps simplify this a bit?

```ruby
status_node = status_nodes.detect { |x| x.get_text('Code').to_s == 'D' }
status_node ||= status_nodes.first
```