Update to use an object model

Also, now checks SSL certs correctly.