Updated for parallel execution