speed up import scripts

* put 'main' function in a transaction
* put a	conditional guard on expensive logging calls