Instead of defaulting output to the empty string which is a bit opaque, why don't we just return early? For example,

```ruby
result = {}
return result if output.nil?
# [...]
```