changed some functions: paprameters pass by ref instead of val..time decreased.. omp taking more time..