Cleaned up flipping bug