Fixed sort for multivariable terms and implemented a better reattachMethods function.