some refactoring of the tdt import code