modified relay thread