finished the calculate procedure.