updated parallel code