It's cleaner to extract the logic to construct the SecureString object from string into a helper function.