Rule: sort variables. Closes #457

Closes #457 Closes #450