Refactored the convert_* functions. Attention! There is a bug somewhere so this compiles, but throws a Not_found exception in runtime.