Moved HTTP client, ssl and some util code into separate files