Refactored T to be more compositional, taking two input languages.