Piece flipping algorithm works flawlessly.