Minor code re-ordering for clarity.