For similar reasons to the previous change, we move this to a single function, so we don't need to duplicate the conversion logic in several places within main.cpp.
For similar reasons to the previous change, we move this to a single function, so we don't need to duplicate the conversion logic in several places within main.cpp.