Normal Placement Wo/constraints

Hey guys,
here's a procedure that I was writing to place one object on to a target object without using constraints because I'd like to write a similar code for Rhino. I'd really appreciate if someone could take a look.

//to excute, select the target obj first and the aggregate last
// you can use a locater as an aggregate to test.

proc J_plot2normals(){
$startFrame = curretTime -q;
$surfaces = ls -sl -dag -s;
$selection = ls -sl;
$Objtarget = $selection[0];
$type = objectType $surfaces[0];
$Objaggregate = $selection[1];
float $p[3]; float $t[3]; float $bt[3];
vector $tan; vector $bitan; vector $norm; vector $v2;

	if($type == "nurbsSurface"){
	
int $Uspans = eval("getAttr " + $surfaces[0] + ".spansU");
int $Udegree = eval("getAttr " + $surfaces[0] + ".degreeU");
int $numCVonU = $Uspans + $Udegree;
		
int $Vspans = eval("getAttr " + $surfaces[0] + ".spansV");
int $Vdegree = eval("getAttr " + $surfaces[0] + ".degreeV");
int $numCVonV = $Vspans + $Vdegree;

		for($u=0;$u< $numCVonU;$u++){
			for($v=0;$v< $numCVonV;$v++){
			
				//watch plot
		int $endFrame = $startFrame++;
		currentTime $endFrame;

				//do calculation of cross product based on U and V tangents
		$UtanObjD = `pointOnSurface -ch on -u $u -v $v -tu $Objtarget`;
		$VtanObjD = `pointOnSurface -ch on -u $u -v $v -tv $Objtarget`;
		vector $tan = `getAttr($UtanObjD + ".position")`;
		vector $bitan = `getAttr($VtanObjD + ".position")`;
		$tan = `unit $v1`;
		$bitan = `unit $v2`;
		$crossObjD = cross ($tan, $bitan);
		$normObjD = `unit $crossObjD`;									//normalized vector (result of cross produce tanU & tanV)
		print ($UtanObjD +"\n"+ $tan +"\n"+ $VtanObjD +"\n"+ $bitan +"\n"+ $crossObjD +"\n"+ $normObjD +"\n");
				//do placement
		select -r $Objaggregate;										// need put pivot at the cv[0][0] position of the object
		xform -ws -t ($normObjD.x) ($normObjD.x) ($normObjD.x);
		}
	}
}

}
//J_plot2normals();

The problem I think is that the placement does not properly align or place the objects correctly, I think the math is okay although I'd rather do this as a matrix in the future when I learn how. I was thinking the point queries are returned in object space an not world??<<
J.christopher@xephaya.com