Some kind of AI optimization/balance.

Also some cleaning.