Refactor ruby/bob