refactoring code, simulation init
refactoring code