fixing ai, adds test script
maybe done??