Cleaned up file initialization and fixed string stream issue.