added working parallel code