finshed converting parse script to C... needs debuggin