working npt code + parallelization