Improve code - use Seq.map instead of foldMap