create thread
thread logic