moved transact library to just helper function