re-written ssl module