added functionality to rebalanceLeft and right