Tried to make the balancing algorithm work better

It doesn't quite work yet, but I'm close