add simulation input and a little refactoring