move outside thread