built js again
move pointer manipulations to C instead of trying to do it in js