my fruitless try to write a general converter function