stats are send to user in CSV format, added some typedefs to make code easier to read
fixed variable name