Small refactor of simluation code for batch processor.