Replaced old code with run_query