Added bulk insertion to ks calculations.