Separate AI from View

Per MPR suggestion : separation of AI from the view.
Improvement of documentation.
Modification of Indentation