how to parallelize this thing?