Refactor to turn converters into HOFs

Instead of storing the output format in a string and then having a big if statement in the converter, this chooses the converter based on the output format.