Optimized transaction.py a bit more