Added url encoding to functions