Refactored createCredentials into private method as per PR comments