optimize balancing check