Finish ai part, but did not test.