I added thread logic.