Better handling for queues

This is part of the work in progress triggered by #3