added batch mode, improved robustness