Added some more handling for transactions