Small movement of code for clarity. Minor refactoring.