Replaced char* with std::string, to avoid unsafe or undefined behaviour