Changed lots of stuff to get SSL working