Updated to use malloc code.