add code for type inference