added simulation::clear for a clean shutdown and reset