refactoring
first version of tw generator