Removed not needed duplicate inserted of the timestamp
Merged max,min,avg into a single write