updated url encoding method