Rewrite using Ruby.