You could use a `collectFirst` here instead of `collect` with `headOption`.