Almost finished rewriting simulate