improving the rebalance code