converted numInitializationAttempts to an input (and corrected out-by-one error in error message).