Restructure of device threads logic