Updated thread.c