DRY-ed up the transaction scripts