working on load balancing function
impl. load balancing. Only 1 thread works now.