<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,18 +1,18 @@
-Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
+Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+claim that you wrote the original software. If you use this software
+in a product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+</diff>
      <filename>License.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,15 @@
-ScalaBox2D version 2.0.1
-
-ScalaBox2D is a 2D physics engine for games.
-It is a Scala port of JBox2D, which is a Java port of Box2D.
-
-Copyright (c) 2009, Erkki Lindpere
-All rights reserved.
-
-This software is distributed under the zlib license. See the file License.txt for the full text.
-
-JBox2D is a port of Box2D
-http://www.jbox2d.org/
-
-Box2D is a 2D physics engine for games created by Erin Catto
-http://www.box2d.org
+ScalaBox2D version 2.0.1
+
+ScalaBox2D is a 2D physics engine for games.
+It is a Scala port of JBox2D, which is a Java port of Box2D.
+
+Copyright (c) 2009, Erkki Lindpere
+All rights reserved.
+
+This software is distributed under the zlib license. See the file License.txt for the full text.
+
+JBox2D is a port of Box2D
+http://www.jbox2d.org/
+
+Box2D is a 2D physics engine for games created by Erin Catto
+http://www.box2d.org</diff>
      <filename>Readme.txt</filename>
    </modified>
    <modified>
      <diff>@@ -92,7 +92,8 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
   }
 
   def testOverlap(p1: Proxy, p2: Proxy): Boolean = {
-    for (axis &lt;- 0 to 1) {
+    var axis = 0
+    while (axis &lt;= 1) {
       val bounds = m_bounds(axis)
 
       assert(p1.lowerBounds(axis) &lt; 2 * proxyCount)
@@ -105,13 +106,15 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
 
       if (bounds(p1.upperBounds(axis)).value &lt; bounds(p2.lowerBounds(axis)).value)
         return false
+      axis += 1
     }
 
     return true
   }
 
   def testOverlap(b: BoundValues, p: Proxy): Boolean = {
-    for (axis &lt;- 0 to 1) {
+    var axis = 0
+    while (axis &lt;= 1) {
       val bounds = m_bounds(axis)
 
       assert(p.lowerBounds(axis) &lt; 2 * proxyCount)
@@ -122,6 +125,7 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
 
       if (b.upperValues(axis) &lt; bounds(p.lowerBounds(axis)).value)
         return false
+      axis += 1
     }
 
     return true
@@ -178,8 +182,10 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
 
             System.arraycopy(m_bounds(axis), upperIndex, m_bounds(axis),
                     upperIndex + 2, boundCount - upperIndex)
-            for (i &lt;- 0 until boundCount - upperIndex) {
+            var i = 0
+            while (i &lt; boundCount - upperIndex) {
                 m_bounds(axis)(upperIndex + 2 + i) = new Bound(m_bounds(axis)(upperIndex + 2 + i))
+                i += 1
             }
 
             // memmove(bounds[lowerIndex + 1], bounds[lowerIndex],
@@ -187,9 +193,11 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
             // System.out.println(lowerIndex+&quot; &quot;+upperIndex);
             System.arraycopy(m_bounds(axis), lowerIndex, m_bounds(axis),
                     lowerIndex + 1, upperIndex - lowerIndex);
-            for (i &lt;- 0 until upperIndex - lowerIndex) {
+            i = 0
+            while (i &lt; upperIndex - lowerIndex) {
                 m_bounds(axis)(lowerIndex + 1 + i) = new Bound(
                         m_bounds(axis)(lowerIndex + 1 + i))
+                i += 1
             }
 
             // The upper index has increased because of the lower bound
@@ -216,12 +224,15 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
             // \n&quot;,lowerValues[axis],proxyId,upperValues[axis],proxyId);
 
             // Adjust the stabbing count between the new bounds.
-            for (index &lt;- lowerIndex until upperIndex) {
+            var index = lowerIndex
+            while (index &lt; upperIndex) {
                 bounds(index).stabbingCount += 1
+                index += 1
             }
 
             // Adjust the all the affected bound indices.
-            for (index &lt;- lowerIndex until boundCount + 2) {
+            index = lowerIndex
+            while (index &lt; boundCount + 2) {
                 val proxyn = proxyPool(bounds(index).proxyId)
                 if (bounds(index).isLower) {
                     proxyn.lowerBounds(axis) = index
@@ -229,6 +240,7 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
                 else {
                     proxyn.upperBounds(axis) = index
                 }
+                index += 1
             }
         }
 
@@ -236,11 +248,13 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
 
         assert(queryResultCount &lt; Settings.maxProxies)
         // Create pairs if the AABB is in range.
-        for (i &lt;- 0 until queryResultCount) {
+        var i = 0
+        while (i &lt; queryResultCount) {
             assert(queryResults(i) &lt; Settings.maxProxies)
             assert(proxyPool(queryResults(i)).isValid)
 
             pairManager.addBufferedPair(proxyId, queryResults(i))
+            i += 1
         }
 
         pairManager.commit()
@@ -285,12 +299,15 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
             // (edgeCount - upperIndex - 1) * sizeof(b2Bound));
             System.arraycopy(m_bounds(axis), upperIndex + 1, m_bounds(axis),
                     upperIndex - 1, boundCount - upperIndex - 1);
-            for (i &lt;- 0 until boundCount - upperIndex - 1) {
+            var i = 0
+            while (i &lt; boundCount - upperIndex - 1) {
                 bounds(upperIndex - 1 + i) = new Bound(bounds(upperIndex - 1 + i));
+                i += 1
             }
 
             // Fix bound indices.
-            for (index &lt;- lowerIndex until boundCount - 2) {
+            var index = lowerIndex
+            while (index &lt; boundCount - 2) {
                 val proxyn = proxyPool(bounds(index).proxyId)
                 if (bounds(index).isLower) {
                     proxyn.lowerBounds(axis) = index
@@ -298,11 +315,14 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
                 else {
                     proxyn.upperBounds(axis) = index
                 }
+                index += 1
             }
 
             // Fix stabbing count.
-            for (index &lt;- lowerIndex until upperIndex - 1) {
+            index = lowerIndex
+            while (index &lt; upperIndex - 1) {
                 bounds(index).stabbingCount -= 1
+                index += 1
             }
 
             // Query for pairs to be removed. lowerIndex and upperIndex are not
@@ -313,9 +333,11 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
 
         assert (queryResultCount &lt; Settings.maxProxies)
 
-        for (i &lt;- 0 until queryResultCount) {
+        var i = 0
+        while (i &lt; queryResultCount) {
             assert(proxyPool(queryResults(i)).isValid)
             pairManager.removeBufferedPair(proxyId, queryResults(i))
+            i += 1
         }
         
         pairManager.commit()
@@ -608,7 +630,8 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
             val boundCount = 2 * proxyCount
             var stabbingCount = 0
 
-            for (i &lt;- 0 until boundCount) {
+            var i = 0
+            while (i &lt; boundCount) {
                 val bound = bounds(i)
                 assert(i == 0 || bounds(i-1).value &lt;= bound.value)
                 assert(bound.proxyId != PairManager.NullProxy)
@@ -626,6 +649,7 @@ class BroadPhase(val worldAABB: AABB, callback: PairListener) {
                 }
 
                 assert (bound.stabbingCount == stabbingCount);
+                i += 1
             }
         }
 </diff>
      <filename>src/main/scala/org/villane/box2d/collision/BroadPhase.scala</filename>
    </modified>
    <modified>
      <diff>@@ -119,13 +119,15 @@ object Distance {
 
   def inPoints(w: Vector2f, points: Array[Vector2f], pointCount: Int): Boolean = {
     val k_tolerance = 100.0f * &#949;
-    for (i &lt;- 0 until pointCount) {
+    var i = 0
+    while (i &lt; pointCount) {
       val d = (w - points(i)).abs 
       val m = Vector2f.max(w.abs, points(i).abs)
 
       if (d.x &lt; k_tolerance * (m.x + 1.0f) &amp;&amp; d.y &lt; k_tolerance * (m.y + 1.0f)) {
         return true
       }
+      i += 1
     }
 
     return false
@@ -155,7 +157,8 @@ object Distance {
 
     val vSqr = 0.0f
     val maxIterations = 20
-    for (iter &lt;- 0 until maxIterations) {
+    var iter = 0
+    while (iter &lt; maxIterations) {
       var v = x2 - x1
       val w1 = shape1.support(xf1, v)
       val w2 = shape2.support(xf2, -v)
@@ -206,8 +209,10 @@ object Distance {
       }
 
       var maxSqr = -Float.MaxValue
-      for (i &lt;- 0 until pointCount) {
+      var i = 0
+      while (i &lt; pointCount) {
         maxSqr = MathUtil.max(maxSqr, points(i) &#8729; points(i))
+        i += 1
       }
 
       if (pointCount == 3 || vSqr &lt;= 100.0f * &#949; * maxSqr) {
@@ -217,6 +222,7 @@ object Distance {
 
         return (MathUtil.sqrt(vSqr), x1, x2)
       }
+      iter += 1
     }
 
     g_GJK_Iterations = maxIterations;</diff>
      <filename>src/main/scala/org/villane/box2d/collision/Distance.scala</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
-&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
-&lt;title&gt;Insert title here&lt;/title&gt;
-&lt;/head&gt;
-&lt;body&gt;
-This package contains broad and narrow phase collision detection.
-
-In the Java version, this also contained shapes, which are now in a separate package.
-&lt;/body&gt;
+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
+&lt;title&gt;Insert title here&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+This package contains broad and narrow phase collision detection.
+
+In the Java version, this also contained shapes, which are now in a separate package.
+&lt;/body&gt;
 &lt;/html&gt;
\ No newline at end of file</diff>
      <filename>src/main/scala/org/villane/box2d/collision/package.html</filename>
    </modified>
    <modified>
      <diff>@@ -333,7 +333,7 @@ class Body(bd: BodyDef, val world: World) {
   }
 
   /** For internal use only. */
-  def synchronizeTransform() {
+  @inline def synchronizeTransform() {
     val rot = sweep.a
     val vx = sweep.c.x - rot * sweep.localCenter.x
     val vy = sweep.c.y - rot * sweep.localCenter.y</diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/Body.scala</filename>
    </modified>
    <modified>
      <diff>@@ -107,7 +107,11 @@ class ContactManager extends PairListener {
 
   def collide() {
     // Update awake contacts.
-    for (c &lt;- world.contactList) {
+    var iC = 0
+    while (iC &lt; world.contactList.length) {
+      val c = world.contactList(iC)
+      iC += 1
+
       val body1 = c.shape1.body
       val body2 = c.shape2.body
       if (!body1.isSleeping || !body2.isSleeping) {</diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/ContactManager.scala</filename>
    </modified>
    <modified>
      <diff>@@ -83,10 +83,17 @@ class Island(val bodyCapacity: Int,
     }
 
     // Solve velocity constraints.
-    for (i &lt;- 0 until step.maxIterations) {
+    var i = 0
+    while (i &lt; step.maxIterations) {
+      i += 1
+
       contactSolver.solveVelocityConstraints()
 
-      for (joint &lt;- joints) {
+      var j = 0
+      while (j &lt; joints.length) {
+        val joint = joints(j)
+        j += 1
+        
         joint.solveVelocityConstraints(step)
       }
     }</diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/Island.scala</filename>
    </modified>
    <modified>
      <diff>@@ -267,7 +267,11 @@ class World(val aabb: AABB, var gravity: Vector2f, doSleep: Boolean) {
     val futures = new ArrayList[Future[Int]]
     */
 
-    for (seed &lt;- bodyList) {
+    var iBody = 0
+    while (iBody &lt; bodyList.length) {
+      val seed = bodyList(iBody)
+      iBody += 1
+
       if (((seed.flags &amp; (BodyFlags.island | BodyFlags.sleep | BodyFlags.frozen)) == 0) &amp;&amp; !seed.isStatic) {
 
       // Reset island and stack.
@@ -291,7 +295,11 @@ class World(val aabb: AABB, var gravity: Vector2f, doSleep: Boolean) {
         // propagate islands across static bodies.
         if (!b.isStatic) {
           // Search all contacts connected to this body.
-          for (cn &lt;- b.contactList) {
+          var iCN = 0
+          while (iCN &lt; b.contactList.length) {
+            val cn = b.contactList(iCN)
+            iCN += 1
+
             // Has this contact already been added to an island?
             if ((cn.contact.flags &amp; (ContactFlags.island | ContactFlags.nonSolid)) == 0 &amp;&amp;
               // Is this contact touching?
@@ -312,7 +320,11 @@ class World(val aabb: AABB, var gravity: Vector2f, doSleep: Boolean) {
           }
 
           // Search all joints connect to this body.
-          for (jn &lt;- b.jointList) {
+          var iJN = 0
+          while (iJN &lt; b.jointList.length) {
+            val jn = b.jointList(iJN)
+            iJN += 1
+
             if (!jn.joint.islandFlag) {
               island.add(jn.joint)
               jn.joint.islandFlag = true</diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/World.scala</filename>
    </modified>
    <modified>
      <diff>@@ -9,10 +9,14 @@ import vecmath.Preamble._
 class ContactSolver(contacts: Seq[Contact]) {
   val constraints = initConstraints(contacts)
   
-  def initConstraints(contacts: Seq[Contact]) = {
+  @inline def initConstraints(contacts: Seq[Contact]) = {
     val tmpConstraints = new collection.mutable.ArrayBuffer[ContactConstraint]
 
-    for (contact &lt;- contacts) {
+    var iContact = 0
+    while (iContact &lt; contacts.length) {
+      val contact = contacts(iContact)
+      iContact += 1
+
       assert(contact.solid)
       val b1 = contact.shape1.body
       val b2 = contact.shape2.body
@@ -25,7 +29,11 @@ class ContactSolver(contacts: Seq[Contact]) {
       val w1 = b1.angularVelocity
       val w2 = b2.angularVelocity
 
-      for (manifold &lt;- manifolds) {
+      var iMF = 0
+      while (iMF &lt; manifolds.length) {
+        val manifold = manifolds(iMF)
+        iMF += 1
+
         assert (manifold.points.length &gt; 0, &quot;Manifold has length 0&quot;)
         val normal = manifold.normal
 
@@ -38,11 +46,14 @@ class ContactSolver(contacts: Seq[Contact]) {
         c.friction = friction
         c.restitution = restitution
 
-        for (k &lt;- 0 until c.points.length) {
+        var k = 0
+        while (k &lt; c.points.length) {
           val cp = manifold.points(k)
           val ccp = new ContactConstraintPoint
           c.points(k) = ccp
 
+          k += 1
+          
           ccp.normalImpulse = cp.normalImpulse
           ccp.tangentImpulse = cp.tangentImpulse
           ccp.separation = cp.separation
@@ -104,11 +115,15 @@ class ContactSolver(contacts: Seq[Contact]) {
     tmpConstraints.toArray
   }
   
-  def initVelocityConstraints(step: TimeStep) {
+  @inline def initVelocityConstraints(step: TimeStep) {
     // Zero temp objects created - ewjordan
 
     // Warm start.
-    for (c &lt;- constraints) {
+    var iConstraints = 0
+    while (iConstraints &lt; constraints.length) {
+      val c = constraints(iConstraints)
+      iConstraints += 1
+
       val b1 = c.body1
       val b2 = c.body2
       val invMass1 = b1.invMass
@@ -119,7 +134,11 @@ class ContactSolver(contacts: Seq[Contact]) {
       val tangent = normal.tangent
 
       if (step.warmStarting) {
-        for (ccp &lt;- c.points) {
+        var iCCP = 0
+        while (iCCP &lt; c.points.length) {
+          val ccp = c.points(iCCP)
+          iCCP += 1
+
           //Inlined all vector ops here
           ccp.normalImpulse *= step.dtRatio
           ccp.tangentImpulse *= step.dtRatio
@@ -132,7 +151,11 @@ class ContactSolver(contacts: Seq[Contact]) {
           b2.linearVelocity += p * invMass2
         }
       } else {
-        for (ccp &lt;- c.points) {
+        var iCCP = 0
+        while (iCCP &lt; c.points.length) {
+          val ccp = c.points(iCCP)
+          iCCP += 1
+
           ccp.normalImpulse = 0f
           ccp.tangentImpulse = 0f
         }
@@ -140,15 +163,21 @@ class ContactSolver(contacts: Seq[Contact]) {
     }
   }
   
-  def solveVelocityConstraints() {
+  @inline def solveVelocityConstraints() {
     // (4*constraints + 6*points) temp Vec2s - BOTTLENECK!
-    for (c &lt;- constraints) {
+    var iConstraints = 0
+    while (iConstraints &lt; constraints.length) {
+      val c = constraints(iConstraints)
+      iConstraints += 1
+      
       val b1 = c.body1
       val b2 = c.body2
       var w1 = b1.angularVelocity
       var w2 = b2.angularVelocity
-      var v1 = b1.linearVelocity
-      var v2 = b2.linearVelocity
+      var v1x = b1.linearVelocity.x
+      var v1y = b1.linearVelocity.y
+      var v2x = b2.linearVelocity.x
+      var v2y = b2.linearVelocity.y
       val invMass1 = b1.invMass
       val invI1 = b1.invI
       val invMass2 = b2.invMass
@@ -166,14 +195,18 @@ class ContactSolver(contacts: Seq[Contact]) {
             //}
             
       // Solver normal constraints
-      for (ccp &lt;- c.points) {
+      var iCCP = 0
+      while (iCCP &lt; c.points.length) {
+        val ccp = c.points(iCCP)
+        iCCP += 1
+        
         // Relative velocity at contact
         //Vec2 dv = v2.add((w2 &#215; ccp.r2));
         //dv.subLocal(v1);
         //Vec2 a = ccp.r1;
         //dv.subLocal(new Vec2(-w1 * a.y, w1 * a.x));
-        val dvx = v2.x - w2 * ccp.r2.y - v1.x + w1*ccp.r1.y
-        val dvy = v2.y + w2 * ccp.r2.x - v1.y - w1*ccp.r1.x
+        val dvx = v2x - w2 * ccp.r2.y - v1x + w1*ccp.r1.y
+        val dvy = v2y + w2 * ccp.r2.x - v1y - w1*ccp.r1.x
 
         // Compute normal impulse
         val vn = dvx*normal.x + dvy*normal.y;//(dv &#8729; normal)
@@ -184,12 +217,16 @@ class ContactSolver(contacts: Seq[Contact]) {
         &#955; = newImpulse - ccp.normalImpulse
 
         // Apply contact impulse
-        val P = normal * &#955;
-        v1 -= P * invMass1
-        w1 -= invI1 * (ccp.r1.x * P.y - ccp.r1.y * P.x) //(ccp.r1 &#215; P);
+        //val P = normal * &#955;
+        val Px = normal.x * &#955;
+        val Py = normal.y * &#955;
+        v1x -= Px * invMass1
+        v1y -= Py * invMass1
+        w1 -= invI1 * (ccp.r1.x * Py - ccp.r1.y * Px) //(ccp.r1 &#215; P);
 
-        v2 += P * invMass2
-        w2 += invI2 * (ccp.r2.x * P.y - ccp.r2.y * P.x) //(ccp.r2 &#215; P);
+        v2x += Px * invMass2
+        v2y += Py * invMass2
+        w2 += invI2 * (ccp.r2.x * Py - ccp.r2.y * Px) //(ccp.r2 &#215; P);
 
         ccp.normalImpulse = newImpulse;
       }
@@ -202,13 +239,17 @@ class ContactSolver(contacts: Seq[Contact]) {
 //    		// #endif
 
       // Solver tangent constraints
-      for (ccp &lt;- c.points) {
+      iCCP = 0
+      while (iCCP &lt; c.points.length) {
+        val ccp = c.points(iCCP)
+        iCCP += 1
+
         // Relative velocity at contact
         //Vec2 dv = v2.add((w2 &#215; ccp.r2));
         //dv.subLocal(v1);
         //dv.subLocal((w1 &#215; ccp.r1));
-        val dvx = v2.x - w2 * ccp.r2.y - v1.x + w1*ccp.r1.y
-        val dvy = v2.y + w2 * ccp.r2.x - v1.y - w1*ccp.r1.x
+        val dvx = v2x - w2 * ccp.r2.y - v1x + w1*ccp.r1.y
+        val dvy = v2y + w2 * ccp.r2.x - v1y - w1*ccp.r1.x
 
         // Compute tangent force
         val vt = dvx * tangent.x + dvy * tangent.y
@@ -220,40 +261,54 @@ class ContactSolver(contacts: Seq[Contact]) {
         &#955; = newImpulse - ccp.tangentImpulse
 
         // Apply contact impulse
-        val P = tangent * &#955;
+        //val P = tangent * &#955;
+        val Px = tangent.x * &#955; 
+        val Py = tangent.y * &#955; 
 
         // b1.m_linearVelocity.subLocal(P.mul(invMass1));
-        v1 -= P * invMass1
+        v1x -= Px * invMass1
+        v1y -= Py * invMass1
         // b1.m_angularVelocity -= invI1 * (r1 &#215; P);
-        w1 -= invI1 * (ccp.r1.x * P.y - ccp.r1.y * P.x)
+        w1 -= invI1 * (ccp.r1.x * Py - ccp.r1.y * Px)
 
         // b2.m_linearVelocity.addLocal(P.mul(invMass2));
-        v2 += P * invMass2
+        v2x += Px * invMass2
+        v2y += Py * invMass2
         // b2.m_angularVelocity += invI2 * (r2 &#215; P);
-        w2 += invI2 * (ccp.r2.x * P.y - ccp.r2.y * P.x)
+        w2 += invI2 * (ccp.r2.x * Py - ccp.r2.y * Px)
 
         ccp.tangentImpulse = newImpulse
       }
-      b1.linearVelocity = v1
+      b1.linearVelocity = (v1x,v1y)
       b1.angularVelocity = w1
-      b2.linearVelocity = v2
+      b2.linearVelocity = (v2x,v2y)
       b2.angularVelocity = w2
     }
   }
   
-  def finalizeVelocityConstraints() {
-    for (c &lt;- constraints) {
+  @inline def finalizeVelocityConstraints() {
+    var i = 0
+    while (i &lt; constraints.length) {
+      val c = constraints(i)
+      i += 1
+
       val m = c.manifold
-      for (j &lt;- 0 until c.points.length) {
+      var j = 0
+      while (j &lt; c.points.length) {
         m.points(j).normalImpulse = c.points(j).normalImpulse
         m.points(j).tangentImpulse = c.points(j).tangentImpulse
+        j += 1
       }
     }
   }
   
-  def solvePositionConstraints(baumgarte: Float): Boolean = {
+  @inline def solvePositionConstraints(baumgarte: Float): Boolean = {
     var minSeparation = 0f
-    for (c &lt;- constraints) {
+    var iConstraints = 0 
+    while (iConstraints &lt; constraints.length) {
+      val c = constraints(iConstraints)
+      iConstraints += 1
+
       val b1 = c.body1
       val b2 = c.body2
       val invMass1 = b1.mass * b1.invMass
@@ -264,7 +319,11 @@ class ContactSolver(contacts: Seq[Contact]) {
 	  val normal = c.normal
 
       // Solver normal constraints
-      for (ccp &lt;- c.points) {
+      var iCCP = 0 
+      while (iCCP &lt; c.points.length) {
+        val ccp = c.points(iCCP)
+        iCCP += 1
+
         val r1 = b1.transform.rot * (ccp.localAnchor1 - b1.localCenter)
         val r2 = b2.transform.rot * (ccp.localAnchor2 - b2.localCenter)
 </diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/contacts/ContactSolver.scala</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
-&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Strict//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
-&lt;title&gt;Insert title here&lt;/title&gt;
-&lt;/head&gt;
-&lt;body&gt;
-This package performs contact handling, and is essentially internal to JBox2d.
-
-The only reason you would ever need to dip into the package is to add additional shapes or object types to JBox2d.
-&lt;/body&gt;
+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Strict//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
+&lt;title&gt;Insert title here&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+This package performs contact handling, and is essentially internal to JBox2d.
+
+The only reason you would ever need to dip into the package is to add additional shapes or object types to JBox2d.
+&lt;/body&gt;
 &lt;/html&gt;
\ No newline at end of file</diff>
      <filename>src/main/scala/org/villane/box2d/dynamics/contacts/package.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>43cbfe3a994ffa7f902fee4c56731137a83702b7</id>
    </parent>
  </parents>
  <author>
    <name>Erkki Lindpere</name>
    <email>villane@gmail.com</email>
  </author>
  <url>http://github.com/Villane/scalabox2d/commit/bf00478cee64f47206852ab76ca92c16e1ffab43</url>
  <id>bf00478cee64f47206852ab76ca92c16e1ffab43</id>
  <committed-date>2009-05-16T10:18:05-07:00</committed-date>
  <authored-date>2009-05-16T10:18:05-07:00</authored-date>
  <message>optimizations</message>
  <tree>6d99cd2b8bc9d718421608f2fdacb04ca1cead20</tree>
  <committer>
    <name>Erkki Lindpere</name>
    <email>villane@gmail.com</email>
  </committer>
</commit>
