Minor refactoring for cleanliness. Always strive for good clean farts.

Fixed some whitespace inconsistencies.
Replaced tabs with spaces.
Wrap in an anonymous function that can be rescoped.