Added expect_type function