delete and rebalance refactor