Implement queue-function