code with nnww vectorized an parallelized