added timestamps. Problem: only last timestamp is saved to output file