Make output function more flexible. The next in line to be refactored is
the replace_non_numeric function.