Fixes many major bugs in simplifier