Fixed major batch refactoring issues