Improved transaction context handling