fixed some parser errors
buggy polynomial orderings and sorting
soriting is working
tweaks to sorting