restructure a bit, changed to stringstream, compile fine