improved ssl connection
formatted code