The system calculates based on the current principal balance and remaining term.  (It does not recalculate based on where the balance of the loan should be according to the original amortization schedule and the contractual remaining term.)