Improved/extended information printed in profiles and plans

Would it be possible to share the code between this function and the operator<<. It feels there is a big overlap. Also, you might want to consider returning the string in a reference parameter to avoid copy.