Flip function done.