
166 P.3d 891 (2007)
2007 WY 140
Michael W. SARR, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. 06-164.
Supreme Court of Wyoming.
August 29, 2007.
*892 Representing Appellant: D. Terry Rogers, Interim State Public Defender; Donna D. Domonkos, Appellate Counsel; Ryan R. Roden, Senior Assistant Appellate Counsel.
Representing Appellee: Patrick J. Crank, Attorney General; Terry L. Armitage, Deputy Attorney General; D. Michael Pauling, Senior Assistant Attorney General; Daniel Fetsco, Senior Assistant Attorney General.
Before VOIGT, C.J., and GOLDEN, HILL, KITE, and BURKE, JJ.
KITE, Justice.
[¶ 1] Michael W. Sarr entered a conditional plea of no contest to one count of simple assault and battery, domestic violence, third or subsequent offense in ten years, in *893 violation of Wyo. Stat. Ann. § 6-2-501(b)(e)(f)(ii) (LexisNexis 2000). On appeal, he claims the sentence the district court imposed was illegal because the statute in effect at the time of the alleged offense allowed a maximum sentence of two years imprisonment, and the district court sentenced him to four to five years under a subsequent statute. He also claims the district court erred in denying his motion to exclude W.R.E. 404(b) evidence involving his conduct immediately before and after the alleged assault.
[¶ 2] We hold the sentence imposed was illegal and order that the sentence be corrected to comply with the statute in effect at the time of the offense. We further hold the district court did not abuse its discretion in denying Mr. Sarr's motion to exclude the Rule 404(b) evidence. Accordingly, we affirm Mr. Sarr's conviction, but remand for imposition of a corrected sentence.

ISSUES
[¶ 3] Mr. Sarr states the issues as follows:
[1.] Is appellant's sentence illegal because the trial court sentenced him under the wrong version of the statute, sentencing him to a longer prison term than was allowed when the offense was committed?
[2.] Did the trial court err in admitting uncharged misconduct evidence because said evidence was more prejudicial than probative?
The State asserts that any sentencing error was harmless and the district court properly admitted the uncharged misconduct evidence.

FACTS
[¶ 4] This case has a long and complex history. In 2001, the State charged Mr. Sarr with six counts of aggravated assault and battery against his wife, Ann Wing. Ms. Wing died prior to trial and was not available to testify. At trial, the court allowed a police officer to testify concerning statements Ms. Wing gave implicating Mr. Sarr. A jury convicted him on five counts. Mr. Sarr appealed, claiming that the admission of Ms. Wing's statements violated his Sixth Amendment right to confront the witnesses against him and there was insufficient evidence to support his conviction. The Court held Mr. Sarr's right of confrontation was not violated, affirmed his conviction on three counts, reversed his conviction on two counts and remanded one of those counts for a new trial. Sarr v. State, 2003 WY 42, 65 P.3d 711 (Wyo.2003).
[¶ 5] Mr. Sarr filed a petition for rehearing in this Court claiming re-trial on the remanded count violated his right not to be twice placed in jeopardy. We granted his petition for the purposes of clarifying our holding that a second trial would not subject Mr. Sarr to double jeopardy. Sarr v. State, 2004 WY 20, 85 P.3d 439 (Wyo.2004). Following the decision on re-hearing, Mr. Sarr filed a petition for writ of certiorari in the United States Supreme Court, which granted the petition, vacated the judgment and remanded the case to this Court for consideration in light of Crawford v. Washington, 541 U.S. 36, 124 S.Ct. 1354, 158 L.Ed.2d 177 (2004). On remand, this Court held the admission of Ms. Wing's statements violated the confrontation clause. We reversed Mr. Sarr's conviction on Counts III, V and VI and remanded Counts I, III, V and VI for trial. Sarr v. State, 2005 WY 67, ¶¶ 7-8, 113 P.3d 1051, 1053-54 (Wyo.2005).
[¶ 6] Back in the district court, the State filed a notice of intent to re-try Mr. Sarr on one count (Count I in the original charging document) of aggravated assault and battery in violation of Wyo. Stat. Ann. § 6-2-502(a)(i) (LexisNexis 2000). Count I alleged that on May 6, 2000, Mr. Sarr drove a truck toward Ms. Wing in an attempt to strike her with the truck. After the parties' presentation of the case, the jury was unable to reach a verdict and the district court declared a mistrial. The State subsequently filed a notice of intent to try Mr. Sarr on Count I again.
[¶ 7] Prior to the trial, the State and Mr. Sarr entered into a plea agreement in which the parties agreed to the following terms: the State would amend the charge of aggravated assault and battery to simple assault and battery, domestic violence, third or subsequent offense in ten years, in violation of § 6-2-501(b)(e)(f)(ii); Mr. Sarr would enter a plea of no contest to the amended charge; *894 Mr. Sarr would be sentenced to four to five years in the Wyoming State Penitentiary with credit for 1,877 days previously served; Mr. Sarr would be released upon sentencing because he had already served more than five years; and Mr. Sarr would reserve his right to appeal any issues raised by motion in either retrial. The district court entered a judgment accepting the plea agreement and, in accordance with the parties' proposal, sentenced Mr. Sarr to a term of four to five years in the Wyoming State Penitentiary.

DISCUSSION
1. Sentence
[¶ 8] In accordance with the terms of the parties' plea agreement, the district court sentenced Mr. Sarr to a term of four to five years in prison pursuant to § 6-2-501(f)(ii) (LexisNexis 2006), the version of the statute in effect at the time of sentencing, which provided:
§ 6-2-501. Simple assault; battery; penalties
* * * *
(f) A household member as defined by W.S. XX-XX-XXX who commits a second or subsequent battery against any other household member shall be punished as follows:
* * * *
(ii) A person convicted upon a plea of guilty or no contest or found guilty of a third or subsequent offense under this subsection against any other household member, after having been convicted upon a plea of guilty or no contest or found guilty of a violation of W.S. 6-2-501(a), (b), (e) or (f), 6-2-502, 6-2-503, 6-2-504 or other substantially similar law of this or any other state, tribe or territory against any other household member within the previous ten (10) years is guilty of a felony punishable by imprisonment for not more than five (5) years, a fine of not more than two thousand dollars ($2,000.00), or both.
The version of the statute in effect at the time the offense was committed provided:
§ 6-2-501. Simple assault; battery; penalties
(f) A household member as defined by W.S. XX-XX-XXX who commits a second or subsequent battery against any other household member shall be punished as follows:
(ii) A person convicted upon a plea of guilty or no contest or found guilty of a third or subsequent offense under this subsection against any other household member, after having been convicted upon a plea of guilty or no contest or found guilty of a violation of W.S. 6-2-501(a), (b), (e) or (f), 6-2-502, 6-2-503, 6-2-504 or other substantially similar law of this or any other state, tribe or territory against any other household member within the previous ten (10) years is guilty of a felony punishable by imprisonment for not more than two (2) years, a fine of not more than two thousand dollars ($2,000.00), or both.
X(f)(ii) (LexisNexis 2000). Wyo. Stat. Ann. § 6-1-101(b) (LexisNexis 2007) of the Wyoming Criminal Code provides in pertinent part: "Prosecutions for a crime shall be governed by the law in effect on the date when the crime occurred." The term "prosecution" includes sentencing. Attletweedt v. State, 684 P.2d 812, 814 (Wyo.1984). Therefore, Mr. Sarr's sentencing was governed by the statute in effect in 2000.
[¶ 9] The determination of whether a sentence is illegal is a question of law, which we review de novo. Doolittle v. State, 2007 WY 52, ¶ 9, 154 P.3d 350, 354 (Wyo. 2007). An illegal sentence is one that exceeds statutory limits, imposes multiple terms of imprisonment for the same offense, or otherwise violates constitutional provisions or the law. Garcia v. State, 2007 WY 48, ¶ 7, 153 P.3d 941, 943 (Wyo.2007). The State concedes that, at the time Mr. Sarr committed the offense in May of 2000, § 6-2-501(f)(ii) provided for a maximum sentence of two years and the sentence the district court imposed (and, in fact, the sentence the parties agreed to in their plea agreement) was based upon an amended version of the statute that increased the maximum sentence to five years. Accordingly, the State concedes the sentence imposed exceeded the two year *895 maximum term allowed under the version of § 6-2-501(f)(ii) in effect at the time Mr. Sarr committed the offense. The State asserts, however, that the sentencing error is harmless because the district court gave Mr. Sarr credit for the time he already had served, which resulted in his release from confinement upon his sentence being entered. Under these circumstances, the State contends, the sentence of five years under the incorrect statute did not affect Mr. Sarr's substantial rights.
[¶ 10] Mr. Sarr asks this Court to reverse his conviction because his sentence was illegal. The law is clear that the validity of a conviction will not be addressed in the context of a claim brought under W.R.Cr.P. 35(a) that the trial court imposed an illegal sentence. Although Mr. Sarr did not bring his claim pursuant to Rule 35, we apply the same principle. His challenge concerns the sentence imposed; he may not use that challenge as a vehicle for overturning his conviction. Evans v. State, 892 P.2d 796, 797 (Wyo. 1995). Our review of his claim of an illegal sentence is limited to determining whether the sentence was illegal and, if we find that it was, correcting it ourselves if the record is sufficient to allow us to do so or, if the record is insufficient, remanding the case to the district court for correction.
[¶ 11] W.R.Cr.P. 52(a) provides: "Harmless error.  Any error, defect, irregularity or variance which does not affect substantial rights shall be disregarded." The State argues that the illegal sentence was harmless because whether the district court sentenced him to two years incarceration under the correct statute or five years under the incorrect statute, Mr. Sarr was released from custody after his sentencing because his presentence incarceration exceeded the allowable term under either provision. In other words, the 1,877 days he served prior to the imposition of sentence satisfied the maximum term allowed by either statute; therefore, the State argues, Mr. Sarr's substantial rights were not affected by the illegal sentence. Mr. Sarr makes no showing that his substantial rights were affected but asserts only that the sentence was illegal and his conviction should be reversed. Thus, Mr. Sarr has not met his burden of proving that his substantial rights were affected.
[¶ 12] Our rules of criminal procedure authorize a trial court to correct an illegal sentence at any time. W.R.Cr.P. 35(a). A motion to correct an illegal sentence is properly addressed to the trial court in the first instance. Kahlsdorf v. State, 823 P.2d 1184, 1189 (Wyo.1991). For reasons of judicial economy, however, we have considered illegal sentence claims when the issue was raised for the first time on appeal, Price v. State, 716 P.2d 324, 328 (Wyo.1986), and when the issue, although mentioned in the trial court, was not pursued until appeal. Kahlsdorf, 823 P.2d at 1189. In Mr. Sarr's case, the issue of the illegal sentence was not raised in the trial court. However, the interests of judicial economy support consideration of the issue by this Court on appeal. When we can correct a sentence from the record before us, we will do so without remanding the case to the district court. Doolittle, ¶ 20, 154 P.3d at 357. Thus, in Kahlsdorf, where the trial court imposed a ten year term of probation that was not authorized by the statute, we reduced the term to five years to bring it into compliance with the maximum period allowed by the applicable statute.
[¶ 13] Here, the record is clear and the parties agree that at the time the district court entered the judgment and sentence, Mr. Sarr had already served 1,877 days in jail. The parties agreed and the district court ordered that upon imposition of the sentence, Mr. Sarr was to be released from custody because he had already served more than the maximum penalty. Under these circumstances, the imposition of a sentence under the incorrect statute was harmless because he has already served more time than either statute allowed. For purposes of correcting the record, however, we remand the case with directions to the district court to enter a new judgment and sentence referencing the applicable statute and imposing a maximum sentence of two years, as allowed by the applicable statute.
*896 2. W.R.E. 404(b) Evidence
[¶ 14] Prior to the first re-trial on Count I that resulted in a mistrial, Mr. Sarr filed a motion asking the State to disclose any W.R.E. 404(b) evidence of uncharged misconduct it intended to introduce at trial. The State responded by filing a notice that it intended to introduce evidence that Mr. Sarr committed other violent acts against his wife on May 6, 2000, immediately before and after the charged attempted assault and battery with the truck. Specifically, the State indicated that it intended to introduce the testimony of Daniel Bryan that before attempting to strike Ms. Wing with the truck, Mr. Sarr threw her to the ground several times in a fit of anger causing her to strike and split open her jaw. The State further indicated it intended to introduce Mr. Bryan's testimony that after attempting to strike Ms. Wing with the truck, Mr. Sarr followed her into the house, grabbed her by the hair and pulled her head back, slamming it into the wall. The State indicated the testimony would be offered to prove intent to cause bodily injury and to rebut a defense that the attempt was not intentional or was accidental. Mr. Sarr responded by filing a motion to exclude the evidence.
[¶ 15] After a hearing, the district court ruled that the testimony concerning Mr. Sarr's acts before the alleged assault with the truck was admissible because it was part of the facts of the case; it was intended to show motive and intent for the crime charged; it was more probative than prejudicial; and it was less serious than the crime charged. Addressing the testimony concerning Mr. Sarr's acts after the incident with the truck, the district court ruled the State would be allowed to present the challenged testimony to rebut any defense of accident or lack of intent. It is not clear from the record provided to this Court whether the testimony in fact was presented during the trial that resulted in a mistrial.
[¶ 16] Prior to the second re-trial, the parties filed similar motions, notices and responses to the testimony concerning Mr. Sarr's actions immediately before and after the alleged assault with the truck. This time, the district court concluded, first, that the testimony was not Rule 404(b) evidence because it described what occurred immediately before and after the charged conduct and provided background as to a continuing sequence of events. The district court stated: "To suppress evidence of these other acts would serve only to deprive the jury of knowing what occurred in the moments before and after the alleged criminal conduct." The district court further concluded, even assuming that the testimony was uncharged misconduct evidence falling under W.R.E. 404(b), it was relevant to show Mr. Sarr's intent and was more probative than prejudicial.
[¶ 17] W.R.E. 404(b) provides:
(b) Other crimes, wrongs, or acts.  Evidence of other crimes, wrongs, or acts is not admissible to prove the character of a person in order to show that he acted in conformity therewith. It may, however, be admissible for other purposes, such as proof of motive, opportunity, intent, preparation, plan, knowledge, identity, or absence of mistake or accident.
A district court's ruling on the admission of evidence under this rule is reviewed for abuse of discretion. Bromley v. State, 2007 WY 20, ¶ 8, 150 P.3d 1202, 1206-07 (Wyo. 2007).
[¶ 18] Pursuant to the rule,
[E]vidence of uncharged misconduct is admissible to prove things other than character. Evidence of specific instances of uncharged misconduct is admissible to prove consequential facts, such as intent, knowledge or identity. The list contained in Rule 404(b) of purposes for which evidence of other crimes may be admissible is not exclusive. We have recognized, for example, that course of conduct evidence involving uncharged misconduct is admissible if it forms part of the history of the event or serves to enhance the natural development of the facts. Uncharged misconduct evidence is not admissible, however, if its only purpose is to show a defendant has a disposition to commit crimes.
Id., ¶ 9, 150 P.3d at 1207 (citations omitted).
[¶ 19] Technically, the testimony describing what happened before and after *897 the charged assault constituted Rule 404(b) evidence because it described other assaults by Mr. Sarr upon Ms. Wing. Therefore, it was not admissible if its only purpose was to show Mr. Sarr's character and that he acted in conformity with it. However, it was admissible if offered to prove other consequential facts. For example, evidence offered to prove course of conduct is admissible when it is relevant and necessary to give a jury a complete understanding of what occurred. Id., ¶ 22, 150 P.3d at 1210. Events do not occur in a vacuum and the jury has the right to have the offense placed in its proper setting. Id. Applying this principle in Bromley where the defendant was convicted of possessing, delivering, and possessing with intent to deliver methamphetamine, we held the district court properly admitted evidence showing the defendant's prior sale and use of methamphetamine with others to show his course of conduct. In Bromley, the testimony involved sales and use months before the charged conduct. Particularly where, as here, the testimony involved the defendant's actions only minutes before and after the charged conduct, we hold it was properly admitted as course of conduct evidence necessary to assist the jury in understanding the course of events and context of the charged conduct.
[¶ 20] In arguing that the district court improperly admitted the testimony, Mr. Sarr focuses primarily on the potential prejudice from the testimony as compared with its probative value. He argues the evidence should have been excluded under W.R.E. 403, which provides in relevant part: "Although relevant, evidence may be excluded if its probative value is substantially outweighed by the danger of unfair prejudice. . . ." Before we will find error from the admission of evidence claimed to be unduly prejudicial, the appellant must demonstrate that the evidence had little or no probative value and was extremely inflammatory or introduced for the purpose of inflaming the jury. Dike v. State, 990 P.2d 1012, 1019-20 (Wyo.1999).
[¶ 21] In its decision letter, the district court outlined the factors this Court identified for consideration in Gleason v. State, 2002 WY 161, ¶ 27, 57 P.3d 332, 342 (Wyo. 2002) in determining the probative value of Rule 404(b) evidence:
1. How clear is it that the Defendant committed the prior bad act?
2. Does the Defendant dispute the issue on which the State is offering the prior bad acts evidence?
3. Is other evidence available?
4. Is the evidence unnecessarily cumulative?
5. How much time has elapsed between the charged crime and the prior bad act?
The district court concluded Mr. Bryan was clear about what he saw and no witnesses disputed his testimony; Mr. Sarr vigorously disputed the issue, i.e. his intent, which the Rule 404(b) evidence was intended to prove; there was no other evidence available showing Mr. Sarr's intent; the evidence was not cumulative; and virtually no time elapsed between the other acts and the charged offense. On this basis, the district court concluded the evidence was very probative.
[¶ 22] The district court also considered the factors outlined in Gleason for determining the prejudicial effect of the challenged testimony:
1. The reprehensible nature of the prior bad act.
2. The sympathetic character of the alleged victim of the prior bad act.
3. The similarity between the charged crime and the prior bad act.
4. The comparative enormity of the charged crime and the prior bad act.
5. The comparable relevance of the prior bad act to the proper and forbidden inferences.
6. Whether the prior bad act resulted in a conviction.
Gleason, ¶ 27, 57 P.3d at 342-43. Weighing these factors, the district court concluded the other acts were not nearly as reprehensible as the offense charged; the alleged victim was deceased and would have no opportunity to testify and evoke sympathy; while all of the acts involved attacks on the victim, the charged conduct was significantly more dangerous *898 and deadly than the other alleged acts; the actions were so close in time as to constitute more of a continuation of behavior than separate acts; and, one of the acts resulted in a domestic violence conviction.[1] Weighing these factors and the factors for determining the probative value of the evidence, the district court concluded the probative value of the evidence outweighed its potential for unfair prejudice. The district court stated:
All of the probative factors weigh in favor of admitting this evidence. While the evidence would obviously be prejudicial to some extent, several of the factors pertaining to prejudice would also weigh more in favor of admitting the evidence.
However, in the final analysis the Court believes that this evidence is more probative than prejudicial due to the minimal time that elapsed between the other acts and the matter charged.
The district court's analysis makes clear that a legitimate basis existed for its ruling. Mr. Sarr has not shown the challenged testimony had little or no probative value or that it was extremely inflammatory. The district court did not abuse its discretion in denying his motion to exclude the testimony.
[¶ 23] Mr. Sarr's conviction is affirmed. We remand the case to the district court for imposition of a new judgment and sentence reflecting that Mr. Sarr entered a plea of no contest to § 6-2-501(b)(e)(f)(ii), a felony, punishable by imprisonment for not more than two (2) years and sentencing him to a maximum term of two years in the Wyoming State Penitentiary with credit for 1,877 days served.
NOTES
[1]  The State alleged in its response to the motion to exclude W.R.E. 404(b) evidence that for the act after attempting to strike Ms. Wing with the truck, Mr. Sarr pled guilty to an amended charge of battery, domestic violence, second offense within five years in violation of § 6-2-501(b).
