lb: change balancing algorithm, new algorithm, minor fixes and refacts