Moved thread queue management to their own functions