Better handling of transactions