added command line params
refactor into transactions