Updated runQuery