Started code for add thread.