Updated queries for cron job