minor corrections diversification, first draft of rebalance function