Condensed the fork method in AI class