Add utility function to_text and to_binary
Use to_text and to_binary