Queue first implementation