Updating getPageTitle to use the new query function