This modification is to avoid duplicate messages when some of them is read on the phone.
That's a bug, the program does not close at keyboard interruption because of threads, I pu a suicide function at the end, but suicide is never the solution.
Imported this script cooked in another repos.