replace hash2urlencode method with URI.encode_www_form
refactoring