refactor logic into Fork class