Consolidating thread stuff into main