Final Final Fix

Fixed the last four memory leaks by using references in certain areas
instead of pointers. That should be everything.