improvement on type inference process