Changed location of function calls.
Changed saved results from quail: less results are saved to mysql.