added code for capturing a frame of the sim.