updated sim code