Avoid call to flatten in most common case
Make sure rhs has been flattened
Recast before flattening
Removing all references to SET