change the function from Map to type