various improvements to the AI functionality
Merge pull request #45 from JeromeLefebvre/master

JeromeLefebvre:master