Working loop through thread