Move bunch of functions from db.scm to dbfile.scm