refactoring
simulation finally fixed