Restructure threading