refactoring: use flatMap to collect items of lists