Broadened the query demoes and rearranged order of functions to be
clearer.