Adding code to complete unfinished simulation.