Revert Steven's patches.
Sorry, I was on the wrong git branch when I checked in my unordered change and accidentally checked in Steven's optimization patches at the same time.