Formatting

Reformats this code into a style I'm personally more comfortable with. It's a bit selfish, but otherwise the formatting war between this code and LGM will be even more painful.