Finished the main body of the AI