added batch mode