Synced with latest simulator code