Extracted simulation code