moved target detection into separate function so we can match different distances and friendly targets