updated script so that the sql queries don't get messed up when there are apostrophes or quotations