Added escape functions to the queries