Rewriting in Ruby