better scoping for DB sessions