Fixed some methods to use relation.
Added greedy operator orders.