By wrapping the entire functionality in here you are essentially saying that the PasswordStrength function will only actually do anything if there's not already a PasswordStrengthWidget in existence. This is undesirable because if I'm using your API I may already have created the widget. So I extracted the logic from this if statement.