Speed improvements.

Added more optimizations to the physics code. Still lots of time spent
on updating each of the IRs.