Move type inference to seperate method