Expression simplification and factoring