added a new parn function to run tasks in parallel