Working refactored version of serial and parallel stream.