refactor simulate