move master thread loop to go loop