better ssl code structure