Credentials refactoring