Logic optimization.