// Tell if the bank account is valid
func (e Exception5Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
	if !e.Handles(b, sc, attempt) {
		panic("Should be exception of type 5")
	}

	if substitution, hasKey := e.Substitutions[b.SortCode]; hasKey {
		b.SortCode = substitution
	}

	// First attempt
	if attempt == 1 {
		checkDigit := b.NumberAtPosition("g")
		remainder := GeneralChecker{}.RemainderFromRegularCheck(b, sc)
		if remainder == 0 && checkDigit == 0 {
			return true
		}
		if remainder == 1 {
			return false
		}

		return (11 - remainder) == checkDigit
	}

	// Second attempt
	checkDigit := b.NumberAtPosition("h")
	remainder := GeneralChecker{}.RemainderFromRegularCheck(b, sc)
	if remainder == 0 && checkDigit == 0 {
		return true
	}

	return (10 - remainder) == checkDigit
}
// Tell if the bank account is valid
func (e Exception9Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
	if !e.Handles(b, sc, attempt) {
		panic("Should be exception of type 9")
	}

	sc.Weights = WeightsForException2Or9(b, sc)
	if (GeneralChecker{}.IsValid(b, sc, attempt)) {
		return true
	}

	// Try to replace the sort code
	b.SortCode = "309634"

	return GeneralChecker{}.IsValid(b, e.Weights[b.SortCode], attempt)
}