added queue logic