Code for sim with more comments