Use Enum.flat_map to simplify