Refactoring and cleanup

Mostly making it more concise / idiomatic Ruby.

I never know how this happens, but a lot of @ohnorobo's commits are in my PR. Git pros please help.