Added sanitizing function to prevent cross site scripting attacks