move all the target finding code to findTarget module