Fixed the weight-based balancing alg.
Credits go to Rob Gagnon (rgagnon24)