Code cleanup and minor style improvements

See: https://github.com/bbatsov/ruby-style-guide
Not particularly fond of this change, I like that the original reflects the appearance of the final output.