Adding offsets for predicates in results.
Removing nested loop.
Changing to branch ends.
Fixing branch checking.