rewrite using std::string