flipping & some cleanup