Added use of a stack for database handles for the /tmp db, converted few more cases to use db:with-db