Cleaned en refactored. Solved bug with wildcards

PatternNodes list of descendants now sorted before returned based on
priotites. Wildcard nodes have lowest priority to ensure that they are
handled last. This prevents a bug with query 5 where the wildcard nodes
matches with a "last" node, and so does the actual "last" pattern node
which is a child of the wildcard node. Nasty fix but could not think of
a different one.

Sorted of descendants now buffered after first computation to reduce
overhead.