More TE refactoring