added compute nearest nieghbor