changed run_cosmics to work with the new parameters.