beautify again with different parameters
Now precompute getnumafrompops, so that updatep can be paralellized