Add functions to convert between internal and external representation.