these used to rely on a db variable, which needed to be replaced by app.db