got find working. the reason it worked only on the left and rightmost
records is because I was using k_i < k <= k_{i+1} instead of
k_i <= k < k_{i+1}