added type_of function