optimize target finding logic