Running pkg_query function