Changed the pattern representation.
Finished rebinding variable names for patterns after sorted.