Switched from the outdated strstream to stringstream.