use of seperate function at start (changes made for implementing openmp)
updated