main_x gets updated with the time whenever a new entry is processed.
Also renamed $p to $paper so the code reads a little more nicely.