this was hell to get the ai to do ...