Added More code to manage queues