dequeue implementation