Refactored login to use 'tryLoginAs'