change data_ptr to return pointer to specific type