purge datastore, sort queries