adding rebalance function but performance still poor