Converted AI from string to type checks