private AVLEntry<K, V> rebalance(AVLEntry<K, V> top) {
		AVLEntry<K, V> leftChild = null;
		AVLEntry<K, V> rightChild = null; 
		AVLEntry<K, V> leftLeftChild = null;
		AVLEntry<K, V> leftRightChild = null;
		AVLEntry<K, V> rightLeftChild = null;
		AVLEntry<K, V> rightRightChild = null;
		
		//ASSIGNMENTS
		
		if (top == null) {
			return null;
		}
		
		if (top.getLeft() == null && top.getRight() == null) {
			return top;
		}
		
		if (top.getLeft()== null) {
			// only has right child
			rightChild = top.getRight();
			rightLeftChild = rightChild.getLeft();
			rightRightChild = rightChild.getRight();
		}
		if (top.getRight()== null) {
			// only has left child
			leftChild = top.getLeft();
			leftLeftChild = leftChild.getLeft();
			leftRightChild = leftChild.getRight();
		}
		
		// SORTING
		if (getHeight(leftChild) > getHeight(rightChild) + 1) {
			if (getHeight(leftLeftChild) > getHeight(leftRightChild)) {
				top = top.rotateRight();
			} else {
				// left left child is less, or equal to, its pair
				top = top.rotateLeftRight();
			}
		} else if (getHeight(rightChild) > getHeight(leftChild) + 1) {
			if (getHeight(rightRightChild) > getHeight(rightLeftChild)) {
				top = top.rotateLeft();
			} else {
				// right right child is less, or equal to, its pair
				top = top.rotateRightLeft();
			}
		}
		return top;
	}