Shuffle some code for clarity and to make lint happy (no real change).