rewriting sim lecture