added remove thread func
added remove thread func