This rather lethal-looking code massively reduces the number of
queries issued to render the feed.