Added some code for nearest neighbor calculation.