changed simulator function