Style clean-up and small refactors

Hi there,

This is mostly a cosmetic PR and small refactoring to clean up styles according to the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). Feedback welcome.