beginning transaction refactor