some refactoring of the converter