added ssl logic