added cli arg parsing, ssl support, and some logging/refactoring
merged changes