Code Formatting

No major change, just rearranged some lines of code for easier reading.