refactor with map.withDefault