Added case 3, and changed the balancing functions to void return type;