start to use type map to determine the type of function