Added better error handling and tracing on queues