Implemented flatMap for Stream