#### ALASKA PROTECTION SERVICES, INC., an Alaska corporation, Appellant and Cross-Appellee, v. FRONTIER COLORCABLE, INC., an Alaska corporation, Appellee and Cross-Appellant.

Nos. 7562, 7609.

Supreme Court of Alaska.

March 23, 1984.

*1121Liv Svendsen Finne, Jack Chisolm, Baro-kas & Martin, Anchorage, for appellant and cross-appellee.

Lewis F. Gordon, Baily & Mason, Anchorage, for appellee and cross-appellant.

Before BURKE, C.J., RABINOWITZ, COMPTON and MOORE, JJ., and SHOR-TELL, Superior Court Judge.*

*

 Shortell, Superior Court Judge, sitting by assignment made pursuant to Article IV, section 16, of the Constitution of Alaska.

OPINION

BURKE, Chief Justice.

In late May of 1980, Alaska Protection Services [APS], doing business as Fairbanks Security Service, entered into a contract with Frontier Colorcable [Frontier] to install various sizes of underground television cable in order to service several communities in Fairbanks, Alaska. This contract provided for the installation of three types of cable: trunk cable, distribution cable and drop-in cable. The trunk cable, the backbone of the system, is joined to the distribution cable, which distributes the TV signal to “pedestals” from which three or more houses are serviced. The drop-in cable joins the pedestal to the individual houses. The contract specified that the distribution cable was to be placed at a depth of twelve to eighteen inches.

APS commenced installation in May, 1980. Frontier employed an inspector who signed daily report sheets verifying the length of cable laid each day. On August 30, 1980, this inspector began signing the daily work sheets with qualifying language indicating concern over the depth of the distribution line. APS nevertheless continued to install the cable until completion in October, 1980, when the cable was energized and put into operation.

After the cable was installed and operating, Frontier encountered twenty-eight instances in which cable TV reception was interrupted due to cuts in the distribution cable (e.g. rototillers or bulldozers had sliced the cable). Indicating dissatisfaction with the depth of the distribution cable, Frontier refused to pay for the trunk, distribution and drop-in cable installed after August 30, 1980. The balance due for those installations was $89,390.07. When subsequent negotiations broke down, APS brought suit to recover the $89,390.07. The trial court, sitting without a jury, found that APS had failed to substantially perform the contract and thus denied any recovery. This appeal followed.

I

At the outset, we are confronted with Frontier’s contention on cross-appeal that APS should never have been allowed to bring suit since it was not properly registered as a construction contractor, pursuant to AS 08.18.011 — AS 08.18.171. Frontier first raised this issue before the trial court in a motion to dismiss. Judge Warren W. Taylor summarily denied the motion. By way of cross-appeal, Frontier now renews its claim that AS 08.18.151 serves as an absolute bar to this action. We reject this contention.

AS 08.18.151 provides:

> A person acting in the capacity of a contractor may not bring an action in a court of this state for the collection of compensation for the performance of work or for breach of a contract for which registration is required under this chapter without alleging and proving that the contractor was a registered contractor at the time of contracting for the performance of the work.

A certificate of registration is issued by the Department of Commerce and Economic Development when an application, together with evidence of bond and insurance cover*1122age, is filed in compliance with the registration requirements.1

' APS contracted in the name of Fairbanks Security Service to perform the cable installation. At the time of contracting, that name was not registered. Instead APS was registered under another trade name— Goldstream Electric. By contracting under the unregistered trade name of Fairbanks Security Service, APS violated AS 08.18.-051, which states in part:

> Except as provided otherwise by state law, no person who has registered under one name as required by this chapter may act in the capacity of a contractor under any other name unless that name also is registered.

APS admits it has violated this section of the statute. But it argues that the penalty for violating section 051 is contained in AS 08.18.141, which makes it a misdemeanor to violate any provision of the chapter. In APS’s view, section 151 should only be applied to bar an action when the contractor has not registered at all at the time of contracting. We agree.

Section 151 imposes a harsh penalty on contractors and thus has not been given a broad or liberal construction. *Industrial Power v. Western Modular Corp.,*623 P.2d 291, 294 (Alaska 1981). In *Industrial Power,*we cited with approval California cases interpreting a provision similar to AS 08.18.151 to require “substantial compliance” rather than strict compliance with the registration provisions of the statute.2 The goal is to determine whether the contractor has sufficiently “afforded the other party the effective protection of the statute.” *Latipac, Inc. v. Superior Court,*64 Cal.2d 278, 411 P.2d 564, 566, 49 Cal.Rptr. 676, (1966). Only when such protection has not been afforded will section 151 operate to bar the contractor access to the courts.

Substantial compliance requires that the contractor be registered and have bonding and insurance coverage, since these are the primary means by which the statute seeks to protect parties dealing with contractors. When a registered contractor violates section 051 by acting under an unregistered name, the proper penalty is not to bar the contractor access to the courts but instead to subject the contractor to misdemeanor prosecution under AS 08.-18.141. Hence to determine whether APS is entitled to maintain this action, our inquiry will focus on whether APS was a registered contractor with bonding and insurance coverage at the time of contracting.3

APS submitted evidence to the trial court which clearly indicated that in May, 1980, the time of contracting, Alaska Protection Service, Inc. was registered under AS 08.18.4 Evidence of insurance and bonding coverage was also submitted. APS has shown that it was a registered contractor at the time of contracting. As such, it has substantially complied with the registration provision of the statute. AS 08.18.151 poses no bar to the maintenance *1123of the action. The trial court’s denial of the motion to dismiss for failure to register is affirmed.5

II

The second issue on appeal centers on the adequacy of Frontier’s pleadings. APS contends that Frontier failed to adequately raise the issue of substantial performance in its pleadings and in its pretrial memorandum. The trial court found that Frontier’s pleadings adequately raised the issue of substantial performance. It further found that APS had not proven substantial performance due to the shallowness of the cable. Therefore, judgment was rendered for Frontier on APS’s claim.

APS then moved to reopen its case in chief and to permit further discovery, arguing that “[bjecause Defendant never properly raised the issue of substantial performance prior to the trial, Plaintiff was not prepared to meet Defendant’s evidence on that point.” APS also argued that it should be entitled to present evidence under a quantum meruit theory. The trial court denied the motion. APS appeals.

APS’s complaint alleged that it fully performed its obligations under the contract. It did not seek alternative recovery under quantum meruit. Frontier’s answer stated, “Defendant denies that plaintiff fully performed its obligations according to the terms of the agreement.” Frontier also filed a counterclaim with its answer, seeking damages attributable to plaintiff’s failure to “perform the work in conformance with the requirements of the contract.”

Both parties recognized that the depth of the cable was the primary issue. However, APS viewed this issue solely in the context of whether Frontier was entitled to damages to offset the amount due under the contract. At trial, however, it became apparent that Frontier viewed the issue as whether APS had substantially performed under the contract.

APS contends the pleadings did not adequately set forth the defense of lack of substantial performance. APS points to Alaska R.Civ.P. 8(c), which requires the defense of failure of consideration6 to be affirmatively set forth in a responsive pleading.7 Moreover, APS cites to Alaska R.Civ.P. 9(c) as requiring “[a] denial of performance or occurrence ... [to] be made specifically and with particularity.”

In regard to the Civil Rule 8(c) challenge, Frontier’s answer does not allege a failure of performance under the caption “affirmative defense.” “The defense of failure of consideration ... [is] not put in issue by denials ... but must be pleaded affirmatively.” *Pacific Indemnity Co. v. Wyrembek,*183 F.Supp. 252, 254-5 (E.D. Wis.1960). Nor does the answer set out what aspect of the performance was insufficient, as required by Civil Rule 9(c). Finally, the denial is in effect a “negative pregnant,” 8 in that it only denies *full*performance, thus arguably allowing the implication that Frontier admits substantial performance.

Moreover, Frontier’s counterclaim was solely in the nature of a setoff against APS’s claim. Frontier sought damages for lack of full performance in the counterclaim — it did not seek to avoid its obligation altogether. Thus, Frontier cannot point to the counterclaim as adequately raising the *1124issue of substantial performance in the pleadings.9

Nor can Frontier point to its pretrial memorandum as establishing a failure of consideration defense.10 This memorandum, submitted less than two weeks before trial, did not even address the failure of consideration issue. In the memorandum, Frontier stated it was “unaware of any contested issues of law.” Instead, Frontier apparently continued to view the dispute in the same manner as it had in its pleadings — revolving around the extent to which Frontier was entitled to an offset for damages. Thus, its memorandum states that the “parties obviously dispute the question of damages.”

Frontier did not assert in its pleadings that due to depth problems it sought to avoid payment to APS altogether.11 APS’s approach at trial is indicative of its reading of the pleadings to not encompass this issue. It produced only one witness during its case in chief who briefly testified that the cable had been installed and that Frontier had not paid the full amount agreed on. It is to promote clarity in situations such as this — where one party alleges a deficiency of performance — that Alaska R.Civ.P. 8(c) requires an affirmative pleading if that party seeks to negate the contract altogether. This Frontier failed to do.12 We therefore find that the defense of failure of consideration was not adequately raised in Frontier’s responsive pleading.

Yet the fact that failure of consideration was not put in issue did not necessarily preclude the trial judge from relying on the theory to deny recovery to APS. In *State v. First National Bank of Anchorage,*660 P.2d 406, 422 (Alaska 1982), we recognized that the trial court has “inherent discretionary authority” to decide a ease on a legal theory not presented in the pleadings.13 But in exercising this discretionary authority, we held:

> The authority to decide a case on an unpled legal theory should be sparingly exercised. In particular it should only be used when the new theory applies to the transaction in issue, is related to the theories presented by the parties, and is necessary for a proper and just disposition of the case....

> Where prejudice will result a court either should not employ a new theory or should take steps to eliminate the prejudice by giving notice that the new theory will be used and affording an opportuni*1125ty to the parties to present evidence and arguments relevant to it.

660 P.2d at 423.

We found in *First National Bank*that the trial court was authorized to entertain a new theory, but erred “in failing to give'' the parties notice that it would do so along with an opportunity to adjust their cases accordingly.” *Id.*The case was therefore remanded to give the parties an opportunity to present evidence relevant to the new theory and thus eliminate any possibility of prejudice which would otherwise result from the court’s reliance on that theory.

A similar analysis is appropriate here. We find no error in the trial court’s use of the theory of failure of consideration. But APS was undoubtedly prejudiced by the introduction of this theory. In its case in chief, APS had proceeded on the assumption that its substantial performance of the contract was not contested by Frontier. Thus, its presentation was limited to one brief witness who testified as to the contract’s existence, performance, and the lack of payment by Frontier. It justifiably read the pleadings as focusing the trial on what amount of recovery, if any, Frontier was entitled to on its counterclaim as an offset. Once the court decided to allow Frontier to develop the issue of substantial performance, the trial court should have taken steps to insure that APS was provided with an opportunity to fairly meet Frontier’s evidence and to develop a quantum meruit theory for recovery. This opportunity could have been provided by reopening the case in chief and allowing further discovery. We find that the trial court abused its discretion by refusing such relief to APS.14

For the foregoing reasons, the order of the superior court denying the motion to reopen the ease in chief and permit further discovery is VACATED and the case is REMANDED for further proceedings consistent with this opinion.

1

. AS 08.18.011, .021, .071, .101.

2

. *Latipac, Inc. v. Superior Court,*64 Cal.2d 278, 411 P.2d 564, 566, 49 Cal.Rptr. 676 (1966); *Walker v. Thornsberry,*97 Cal.App.3d 842, 158 Cal.Rptr. 862 (1979); *Jackson v. Pancake,*266 Cal.App.2d 307, 72 Cal.Rptr. 111 (1968).

3

. We note that in the instant case we are dealing with a single entity, as opposed to a joint venture. Thus, the special provision for joint venture registration set forth in AS 08.18.011 need not concern us. *Cf. Fomby v. Whisenhunt,*680 P.2d 787 (Alaska 1984).

4

. In its complaint, APS contended it was entitled to maintain the action because its "subsidiary,” Goldstream Electric, was registered. APS now contends that "[a]ny characterization at trial of Fairbanks Security Service or Gold-stream Electric as 'subsidiaries’ of Alaska Protection Services, Inc., was not meant to convey the impression that these names represented the names of separate corporations.” The evidence which APS submitted to the trial court established that both Fairbanks Security Service and Goldstream Electric were not separate corporations, but solely trade names under which APS did business. Although the complaint was not amended to conform to the evidence, "failure so to amend does not affect the result of the trial of these issues.” Alaska R.Civ.P. 15(b). *See also*3 J. Moore, Moore’s Federal Practice § 15.13[2], at 15-169 n. 15 (1983). Instead, the complaint will be deemed amended to conform to the evidence.

5

. As an alternative ground for affirmance of this issue, APS contends that the activities it performed did not require registration under the provisions of AS 08.18. We need not decide whether underground cable installation is an activity for which registration is required, since assuming such activity does require registration, we find that APS adequately complied.

6

. Failure of consideration is essentially identical to lack of substantial performance. *See generally*1 A. Corbin, Corbin on Contracts § 133, at 572 (1963).

7

. Alaska R.Civ.P. 8(c) states in part:

> In pleading to a preceding pleading, a party shall set forth affirmatively ... failure of consideration ....

8

. *See*5 C. Wright & A. Miller, Federal Practice and Procedure § 1267 (1969).

9

. Indeed, even at the conclusion of the trial, Frontier acknowledged that the counterclaim was an offset, relevant only if APS prevailed on its complaint.

10

. *See*Alaska R.Civ.P. 16(c).

11

. If Frontier had viewed the depth problem as indicative of a lack of substantial performance, presumably it should have sought to recover the considerable amounts it had already paid APS for the cable installation. *Cf. Nordin Constr. Co. v. City of Nome,*489 P.2d 455, 458 (Alaska 1971) (City sued construction company alleging substantial nonperformance and sought reimbursement for amounts already paid).

12

. Nor did APS impliedly consent to trial of the substantial performance issue. *See*Alaska R.Civ.P. 15(b) ("When issues not raised by the pleadings are tried by express or implied consent of the parties, they shall be treated in all respects as if they had been raised in the pleadings."). Although APS clearly understood that the depth issue was the major dispute between the parties, it did not equate such alleged defective performance with a failure of performance. It viewed the depth issue solely as a question of whether Frontier was entitled to offset. When these two concepts were first equated by Frontier's third witness, APS repeatedly objected to the witness’ testimony. Although APS did not object earlier to two other Frontier witnesses that discussed the depth of the cable and the later “dig-ups,” such testimony was relevant to the issue already in the case, *i.e.,*whether APS had fully or only substantially complied with the contract. When evidence is relevant to an issue already in the case and there is no indication that the party introducing the evidence is seeking to introduce a new issue, it will not be considered as creating an implied consent to try the new issue. *Transamerica Title Insurance Co. v. Ramsey,*507 P.2d 492, 499 (Alaska 1973).

13

*.See also Brown v. Termplan, Inc.,*693 F.2d 1047 (11th Cir.1982) (district court acted within its discretion when it entertained an issue presented under a liberal reading of one litigant's brief even though not clearly articulated therein).

14

. In this respect, this case differs considerably from *Nordin. Constr. Co. v. City of Nome,*489 P.2d 455 (Alaska 1971). There, the City specifically alleged failure of substantial performance by Nordin. *Id.*at 457. It did not proceed on a theory of damages for defective performance. The City in fact had brought the suit against the contractor seeking restitution of money already paid. Unlike APS, Nordin was unquestionably fully aware that substantial performance was the major issue of the trial. Hence it could not recover under quantum meruit when it had failed to present any evidence to support such a theory. In contrast, here APS could reasonably conclude under the pleadings that substantial performance was not in issue. Thus it could not fairly be required to present evidence of quantum meruit at trial absent sufficient notice of the trial court’s reliance on the substantial performance theory.