Minor refactoring in typing