first parallel version
parallelism only needed with input files