refactored request to its own function and put SSL check on one line with request