Trying to finish the find next node algorithm.
Stack overflow