Mostly fixed the AI, except for two side condition