Cleaned nearest neighbour implementation. Added performance timers