Changed type to pointer and allocated on the heap