otmar's ideas on how the algorithm should work

Do away with the specific sequence of lookup.

Consider the problem-space to be a graph-search problem and implement a generic search algorithm there.
Merge pull request #2 from otmarlendl/rest

otmar's ideas on how the algorithm should work