rewrite with pointers
rewrite with pointers