Working on memory allocation. Still not working correctly.