added example thread code