super minor, but you can just say `.headOption.isDefined` here instead of explicitly matching on it.