abstraction of queue logic