Implemented some destruction and memory optimization.