moved parallel code to main