Cleanup all code for consistency, and clarity.

Can move the declaration back into the if.