convert metadata parsing to std::string, which cleans the code
up a fair bit