Finished commenting and set up main to deallocate memory on exit.