Improved simplify