updated with improved HTTPS capability