updated ai, but need to find extraneous end