Use ruby idiom

I split my changes into 6 different commits. Please let me know if any of these is not good for you.