Added automatic transaction bundling to the Database class, with rollbacks on errors