Retain a consistent code style

Retain a consistent code style with the rest of the code and ruby's unofficial styling.

Most of the changes are motivated by earlier style used in the code, and sometimes by what's common ruby style, e.g. do/end instead of brackets for several rows when precedence isn't an issue.