This is a big diff with no functionality change. We just reorder some code,