added search and sort to AI