add AI
Some improvements