First stab at k-nn distance computation