Rewrite with Ruby