Completed remove function withg rebalancing