This `map {}.compact` looks a bit messy to me. I think `reduce` is more appropriate here.