More mem mgmt improvement
Cleanup
Add some compiler optimization switches