Optimized to get closest target