Added some logic to queuemanager