rename some variables and add transaction API