Optimize initial an final flipping