`collect` is better than `flatMap` in this circumstance.