Updated query statements to use escaped double quotes to avoid conflicting with single quotes in text being written