running main in a transaction