Split out ai and generator into separate files.