updated with ssl support