- Updated code thread logic