Updated code to queue and insert sensor ids