Add automatic flatten to diagonal right and left.
Cleanup.