clean code and use "Map" instead of "array"