Refactor simulator significantly