added thread context switch