Refine type inference method