implemented stringstreams for all function outputs