refactor findNeighbors