put map function in proper place.