Modified script due to a misunderstanding of what str_queryf() was