getUserName() refactored