Implemented constantFix, now sorted-flatten has finally stopped looping, thought it isn't being simplified as far as it should.
Finally got sorted-flatten and flatten-ins fusing correctly. Now to get sorted-treesort working.