Finished implementing flip.