Rewrite navigator in ruby