Added support fo sms two-factor authentication, removed some redundant/unused imports/variables, refactored open io statements using 'with open' for auto teardown/closing