Fixed a few bugs. Added better SSL root cert handling. Added proper connection test