Added error handling ability to methods in AI class.