Added shape flipping.