NO TICKET: First commit of adding thread safetly