defined function to search for NN, now just have to implement it ;-)