Tweak queries and deploy script