slight modification to map_output