I see you are replacing double quotes to single quotes at some places, might as well do it for all the changed lines. I commented on a few but they are not exhaustive.