modified algorithm for dfj style parallelism