back and forth optimization