Worked on AI. Refactored. Still does not work