Added database to allow script to crash and be recovered without spamming the phone. Not sure if the de-dup is working at the moment. Phone is out of commission at the moment.