Assignment 6 Memory Management Solution