refactor findNeighbors improved