second version of MSHA scripts, almost done