Use dequeue rather than remove, thanks @elemoine