SCalMod main code