add transactions
make transactions threadsafe