little refactoring and batch file fix