Remove some for-in loops that were preventing optimization.