Refactor fetch_output to reduce complexity. Still gross, maybe grosser?

Stopping here :).