Got the message thing to work using lastTimeRun. The file writing might be iffy (might have to write to ~ and rename over).