Factored out the sqlite functionality into functions below main, implemented command line parsing, and stubbed in postgres as a 2nd database. Postgres implementation is not started yet, just stub entrypoint for it to be fleshed out later.