reworked database & added leading zeros

Other save functionality didn't work. This one is untested but looks
more promising. Timestamp crashes the program though.