modified ms_calculator.m