refactor simulator