Dangerous std::string usage + few minor optimisations