Major changes to makefile, restructed code to use free rather than separate TP_destroy, RP_destroy commands