readded omp loops and fixed intermediateoutput
intermediate output and omp loops fixed