Cache fix from upstream API change.
Cleaned up query processing.
Minor aesthetic changes.