Added an insert function with rollback clause.