Added thread sample code