removed encodeURIcomponent function, replaced withe escape/unescape