Refactor the conversion functions to classes and pass an instance to the new function AllocateConvert().