Simplified code, and re-enabled SSL support.