Refactor fork.rb