renamed title
moved escape query function