Simplified some code and variable names, re-added std::string as the buffer in output.cpp