Fixed AI

Major Cleanup of code, removed unused variables, and fixed the AI