adding mutex lock for thread sync
adding balancer