changed ptr to array