refactor to use flags for argument parsing for login and logout