Enhanced threads C script