Fixed Nullpointer issues and implemented batch run with possibility of
changing number of runs.