Added functions to encode/decode URLs