Added in incrementing the data pointer and resizing the array, need to test the freeState function