Improved cleanup on diffs and use it on input expression.