added DetectTargetCode