changed cache strategy, tidied up query string handling