str allocation, file writing improvements.