Minor refactoring in trntsession