Add dynamic memory allocation