First working version after animation/ai merge