     |> parse_response
   end
 
-  def weather_url_today(city, format \\ "html", unit \\"metric") do
-    "#{@weather_url_api_today}?q=#{city}&mode=#{format}&units=#{unit}&&APPID=#{@api_token}"
+  def weather_url_today(city, format \\ "html", units \\"metric") do
+      # old way  "#{@weather_url_api_today}?q=#{city}&mode=#{format}&unit=#{unit}&&APPID=#{@api_token}"
+    url_params_encoded = URI.encode_query %{
+    		       "q" => city , 
+		       "mode" => format, 
+		       "unit" => units, 
+		       "appid" => @api_token
+		       }
+    "#{@weather_url_api_today}?#{url_params_encoded}"
   end
 
-  def weather_url(city, format \\ "json", unit \\"metric", number_of_days \\ 3 ) do
-    "#{@weather_url_api}?q=#{city}&mode=#{format}&cnt=#{number_of_days}&units=#{unit}&&APPID=#{@api_token}"
+  def weather_url(city, format \\ "json", units \\"metric", number_of_days \\ 3 ) do
+    # old way "#{@weather_url_api}?q=#{city}&mode=#{format}&cnt=#{number_of_days}&unit=#{unit}&&APPID=#{@api_token}"
+    url_params_encoded = URI.encode_query %{
+    		    "q" => city , 
+    		    "mode" => format, 
+		    "units" => units, 
+		    "cnt" => number_of_days , 
+		    "appid" => @api_token
+		    }
+    IO.inspect "#{@weather_url_api}}?#{url_params_encoded}"
+    "#{@weather_url_api}?#{url_params_encoded}"
   end
 
   def parse_response({:ok, %HTTPoison.Response{status_code: 200, body: body}}) do
-    #IO.puts body
     parse_body(body)
   end
 

  end

  def show_weather(conn, %{"city" => city}) do
  a_response = fetch(city)
  a_today = fetch_today(city)
  conn


 # Valid json goes here and need to parse valid string
  def format_render_response(conn, %{response_body: a_body},  %{response_body: today_body} ) do
    IO.puts a_body
    response = Poison.Parser.parse!(a_body)
    conn
    |> assign(:w_data, response["list"])
    |> assign(:today, today_body)
