changed thred to code