Code cleanup in aiinterface