How to use the queue function