Split out AI into separate file