Changed init and added SSL support