lots of changes

added a link to the list template so we can get nice shareable links
refactor db code

added debug back in and added some refactoring to sqlite calls so it's
less ugly