Further tweaks to flow stats logging.

Next steps are to clean up code, and log to file instead of stdout