This works but the ai gets a little sluggish