Changed many functions + added new AI