Better implemtation of SSL