Update configuring logic. Use web urls for downloading configs and certificate
Refactoring, code cleanup, add comments.