Single quote is now escaped properly. Tweaked the comments a little.