Infrastructure stuff for getting info from the database