Added infer type function