Writing a custom data type converter