Optimize 2:1 balance algorithm.