added internal queue functionality - enqueue, dequeue - not tested
added internal queue functionality - enqueue, dequeue - not tested
got the ais code, modifying and incorporating