added thread safty