Almost finished implementing AI - lingering segfault