Split infobox generation out into its own function.