Rewrite without ruby