added the http/https if/else construction