I added some logic to optimize cell flipping