Some refactoring, added ssl, that kind of thing