Move callback thread into a separate method. Fix a bug that broke the loop (status[:connection] check at the end of the loop)