Cleanup of queue code.