computing all kp at one go, maybe parallelize?