Moving stuff around in appdb.py, adding functions to connect/disconnect from the database.