Rule 12. Defenses and objections.

(a) When presented. Unless otherwise provided by statute or order of the court, a defendant shall serve an answer within twenty days after the service of the summons and complaint is complete within the state and within thirty days after service of the summons and complaint is complete outside the state. A party served with a pleading stating a cross-claim shall serve an answer thereto within twenty days after the service. The plaintiff shall serve a reply to a counterclaim in the answer within twenty days after service of the answer or, if a reply is ordered by the court, within twenty days after service of the order, unless the order otherwise directs. The service of a motion under this rule alters these periods of time as follows, unless a different time is fixed by order of the court, but a motion directed to fewer than all of the claims in a pleading does not affect the time for responding to the remaining claims:

(a)(1) If the court denies the motion or postpones its disposition until the trial on the merits, the responsive pleading shall be served within ten days after notice of the court's action;

(a)(2) If the court grants a motion for a more definite statement, the responsive pleading shall be served within ten days after the service of the more definite statement.

(b) How presented. Every defense, in law or fact, to claim for relief in any pleading, whether a claim, counterclaim, cross-claim, or third-party claim, shall be asserted in the responsive pleading thereto if one is required, except that the following defenses may at the option of the pleader be made by motion: (1) lack of jurisdiction over the subject matter, (2) lack of jurisdiction over the person, (3) improper venue, (4) insufficiency of process, (5) insufficiency of service of process, (6) failure to state a claim upon which relief can be granted, (7) failure to join an indispensable party. A motion making any of these defenses shall be made before pleading if a further pleading is permitted. No defense or objection is waived by being joined with one or more other defenses or objections in a responsive pleading or motion or by further pleading after the denial of such motion or objection. If a pleading sets forth a claim for relief to which the adverse party is not required to serve a responsive pleading, the adverse party may assert at the trial any defense in law or fact to that claim for relief. If, on a motion asserting the defense numbered (6) to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56.

(c) Motion for judgment on the pleadings. After the pleadings are closed but within such time as not to delay the trial, any party may move for judgment on the pleadings. If, on a motion for judgment on the pleadings, matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56.

(d) Preliminary hearings. The defenses specifically enumerated (1)-(7) in subdivision (b) of this rule, whether made in a pleading or by motion, and the motion for judgment mentioned in subdivision (c) of this rule shall be heard and determined before trial on application of any party, unless the court orders that the hearings and determination thereof be deferred until the trial.

(e) Motion for more definite statement. If a pleading to which a responsive pleading is permitted is so vague or ambiguous that a party cannot reasonably be required to frame a responsive pleading, the party may move for a more definite statement before interposing a responsive pleading. The motion shall point out the defects complained of and the details desired. If the motion is granted and the order of the court is not obeyed within ten days after notice of the order or within such other time as the court may fix, the court may strike the pleading to which the motion was directed or make such order as it deems just.

(f) Motion to strike. Upon motion made by a party before responding to a pleading or, if no responsive pleading is permitted by these rules, upon motion made by a party within twenty days after the service of the pleading, the court may order stricken from any pleading any insufficient defense or any redundant, immaterial, impertinent, or scandalous matter.

(g) Consolidation of defenses. A party who makes a motion under this rule may join with it the other motions herein provided for and then available. If a party makes a motion under this rule and does not include therein all defenses and objections then available which this rule permits to be raised by motion, the party shall not thereafter make a motion based on any of the defenses or objections so omitted, except as provided in subdivision (h) of this rule.

(h) Waiver of defenses. A party waives all defenses and objections not presented either by motion or by answer or reply, except (1) that the defense of failure to state a claim upon which relief can be granted, the defense of failure to join an indispensable party, and the objection of failure to state a legal defense to a claim may also be made by a later pleading, if one is permitted, or by motion for judgment on the pleadings or at the trial on the merits, and except (2) that, whenever it appears by suggestion of the parties or otherwise that the court lacks jurisdiction of the subject matter, the court shall dismiss the action. The objection or defense, if made at the trial, shall be disposed of as provided in Rule 15(b) in the light of any evidence that may have been received.

(i) Pleading after denial of a motion. The filing of a responsive pleading after the denial of any motion made pursuant to these rules shall not be deemed a waiver of such motion.

(j) Security for costs of a nonresident plaintiff. When the plaintiff in an action resides out of this state, or is a foreign corporation, the defendant may file a motion to require the plaintiff to furnish security for costs and charges which may be awarded against such plaintiff. Upon hearing and determination by the court of the reasonable necessity therefor, the court shall order the plaintiff to file a $300.00 undertaking with sufficient sureties as security for payment of such costs and charges as may be awarded against such plaintiff. No security shall be required of any officer, instrumentality, or agency of the United States.

(k) Effect of failure to file undertaking. If the plaintiff fails to file the undertaking as ordered within 30 days of the service of the order, the court shall, upon motion of the defendant, enter an order dismissing the action.