It basically moves all unnecessary checks out of the loop makes everything local for speed.